Change entities names in wordpress

how to change names of elements in wordpress admin panel? For example change "Posts" on "Products", with all forms, existing anywhere. I know, that when I create my own taxonomy, I can set all the forms of it's name. May be I can make something like that for general names of entities like Posts and Pages?


You can change the name in the init action hook, like so:

function change_post_object_label() {
    global $wp_post_types;

    $labels = &$wp_post_types['post']->labels;
    $labels->name = 'Products';
    $labels->singular_name = 'Product';
    $labels->add_new = 'Add Product';
    $labels->add_new_item = 'Add Product';
    $labels->edit_item = 'Edit Products';
    $labels->new_item = 'Product';
    $labels->view_item = 'View Product';
    $labels->search_items = 'Search Products';
    $labels->not_found = 'No Products found';
    $labels->not_found_in_trash = 'No Products found in Trash';
add_action( 'init', 'change_post_object_label' );

To change the Menu Label though you gotta use a separate hook: admin_menu

function edit_menu_items() {
    global $menu;
    global $submenu;

    $menu[5][0] = 'Products';
    $submenu['edit.php'][5][0] = 'Products';
    $submenu['edit.php'][10][0] = 'Add Product';
add_action('admin_menu', 'edit_menu_items');
Tags: Wordpress

Similar questions

Wordpress - HTML Entities are being Displayed
I am currently developing a Wordpress site, and everytime a comment, page or article is added/retrieved, the HTML entites in the text are encoded, particulary single quotes/double quotes, like #089A. Is there a setting or something that can be enabled/disabled that does this? I've tried the usual Google searches but alas I can't find anything. Chee...
Stop WordPress from using html entities in <title></title>
Google only cares about 65 characters of the <title></title> of any web page. It's a rare and precious space in terms of SEO and we want it to contain as many keywords as possible. However, WordPress keeps converting single character such as '-' into html entities '&#8211;' that is unwanted and lengthy, unnecessarily taking up preci...
Prevent auto html entities in wordpress
Apache 2 Php 5.2.9 Mysql 5.077 Wordpress 3.5.1 After I installed wordpress, I chose a theme named 'Sliding Door'. Then, I turned to write a front page. After I finished it and pressed 'Publish', the raw html content suddenly turned into html entities, just like this: When edit in Text Editor, not Visual Editor: After press 'Publish', still in Text ...
WordPress: How to store entities in plugin?
I am developing a plugin in WordPress that is about to store configurable entities. They are jobs to be done by Cron. There are plenty of them and each one has name, frequency and some additional data. There are discussions how to store post-related data in plugins, whether to use postmeta table or own tables. It is officially adviced to use postme...
HTML entities are not being decoded when using WordPress REST API for Gutenberg blocks
I am building a custom Gutenberg block that makes a request to the WordPress REST API to get some Posts. I'm using axios to make the request to the REST endpoint. When the result comes back, there is an array of Post objects, and I can see the titles of the Posts, but they are all contained in the JSON object as title.rendered and contain HTML enti...
How do I add nested JSON-LD Schema entities in WordPress
Rather than using a plug-in I am in the process of creating my own schema markup for a home page on a WordPress site which makes use of Advananced Custom Fields (ACF) for some of the content relevant to this challenge. My aim is to give me a little more granular control over what is output and as a little personal challenge :) So far I have success...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.