AI Verified

Name

Rename Posts to News

About

Posts is a rather general terms. Some clients like to rename this to something more specific like "News".

Language

PHP

Rating

Voted: 0 by 0 user(s)

How to Setup Snippet

Just stick the code in your functions.php file.

Codevault

Clarke-Design

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: 6.1

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

Website/ Profile URL:

https://www.clarkedesign.co.uk/

History

Last modified:

25/11/2022

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Found 0 vulnerabilities

Rename Posts to News

 
                    
1// ############################
2// ### Rename Posts to News
3// ############################
4add_action( 'init', 'change_post_object_label' );
5function change_post_menu_label() {
6 global $menu;
7 global $submenu;
8 $menu[5][0] = 'News';
9 $submenu['edit.php'][5][0] = 'List News';
10 $submenu['edit.php'][10][0] = 'Add a News Article';
11 $submenu['edit.php'][16][0] = 'News Tags';
12 echo '';
13}
14 
15add_action( 'admin_menu', 'change_post_menu_label' );
16function change_post_object_label() {
17 global $wp_post_types;
18 $labels = &$wp_post_types['post']->labels;
19 $labels->name = 'News';
20 $labels->singular_name = 'News Article';
21 $labels->add_new = 'Add a News Article';
22 $labels->add_new_item = 'Add a News Article';
23 $labels->edit_item = 'Edit News Article';
24 $labels->new_item = 'News Article';
25 $labels->view_item = 'View News Article';
26 $labels->search_items = 'Search News';
27 $labels->not_found = 'No News found';
28 $labels->not_found_in_trash = 'No News found in Trash';
29}
30 
31add_action( 'admin_bar_menu', 'change_wp_admin_bar', 80 );
32function change_wp_admin_bar( $wp_admin_bar ) {
33 $new_post_node = $wp_admin_bar->get_node( 'new-post' );
34 $new_post_node->title = 'News'; // Change title
35 $wp_admin_bar->add_node( $new_post_node ); // Update Node
36}

0

Related Snippets

Please see some snippets below related to this snippet..

WordPress Admin

AI Verified

0

ACF Backend

Added: 1 year ago

Last Updated: 1 year ago

customizes the ACF where you edit pages and posts

WordPress Admin

AI Verified

1

Disable XML-RPC

Added: 1 year ago

Last Updated: 1 year ago

WordPress Admin

AI Verified

0

Empty WP Trash in 5 days

Added: 1 year ago

Last Updated: 1 year ago

Set the number of days to purge items marked as trash in the database. This will happen every 5 days. You can change the 5 to any number such as 7 days for weekly and 30 days for monthly.

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

WordPress Admin

AI Verified

0

Rename Posts to News

Added: 1 year ago

Last Updated: 1 year ago

Posts is a rather general terms. Some clients like to rename this to something more specific like "News".

General

AI Verified

0

Stop P tags

Added: 1 year ago

Last Updated: 1 year ago

Prevent wordpress from automatically adding p tags around everything

Tracking - Analytics

AI Verified

0

Insert Google Analytics in Header

Added: 1 year ago

Last Updated: 1 year ago

Insert Google Analytics in Header