How to change the “Edit Page” frontend toolbar text in WordPress? (Snippet)

I am looking for a snippet function to replace the default “Edit Page” text that shows in the WordPress toolbar.

I have disabled it on the backend altogether, because I am using a frontend builder for Editing pages and I want clients to understand which button does what. On the frontend I only have two options for an admin in the Toolbar > “Edit Page”, “Edit Frontend”. I want to change “Edit Page” to Edit Backend.

Read More

The “Edit Backend” text I think will suffice in the concept for where “Edit Page” would be “Edit Post”, “Edit Product”, etc. since the Frontend Builder handles all post types.

I would like a function snippet so I can leave the WordPress core alone and updates are seamless.

I’m new here too, so thanks for listening and the help!
You have already helped me learn a lot from other searches, but I now officially have an account.

UPDATE:

I wanted this snippet to just reflect when viewing the frontend of the site while logged in. The official code I’ve used to achieve this is below.

(I just wrapped Dylan’s code in the is_admin)

The reason for this was frontend editors. I want it to be simple on the frontend saying “Edit Frontend” or “Edit Backend”.

// Change The Edit Toolbar Text "Edit" to "Edit Backend"
add_action('wp_before_admin_bar_render', 'change_admin_bar',999);

function change_admin_bar() {

    if ( ! is_admin() ) {

    global $wp_admin_bar;
    $wp_admin_bar->remove_node('edit');

    $args = array(
        'id' => 'edit',
        'title' => 'Edit Backend',
       'href' => get_edit_post_link(),
    );

    $wp_admin_bar->add_node($args);

    }
}

Related posts

Leave a Reply

2 comments

  1. I’m not sure if I misunderstood the question, but from what I gathered, you actually wanted to change the text of the WordPress admin bar so I’ve written up some code that can be placed in your functions.php file to do just that.

    add_action('wp_before_admin_bar_render', 'change_admin_bar',999);
    
    function change_admin_bar() {
        global $wp_admin_bar;
        $wp_admin_bar->remove_node('edit');
    
        $args = array(
            'id' => 'edit',
            'title' => 'Edit Backend',
           'href' => get_edit_post_link(),
        );
    
        $wp_admin_bar->add_node($args);
    }
    

    Here are some sources for further research:
    http://sumtips.com/2011/03/customize-wordpress-admin-bar.html
    http://codex.wordpress.org/Plugin_API/Action_Reference/wp_before_admin_bar_render
    http://codex.wordpress.org/Class_Reference/WP_Admin_Bar/add_node

  2. This text is stored in post type labels. reference to available labels.
    If you want to change labels of default post types you’ll need to redeclare this post type with smth like this (example for changing posts label to “News”):

    function yourprefix_change_post_label() {
        global $menu;
        global $submenu;
        $menu[5][0] = 'Articles';
        $submenu['edit.php'][5][0] = 'Articles';
        $submenu['edit.php'][10][0] = 'Add Article';
        $submenu['edit.php'][16][0] = 'Articles Tags';
        echo '';
    }
    function yourprefix_change_post_object() {
        global $wp_post_types;
        $labels = &$wp_post_types['post']->labels;
        $labels->name = 'Articles';
        $labels->singular_name = 'Article';
        $labels->add_new = 'Add Article';
        $labels->add_new_item = 'Add Article';
        $labels->edit_item = 'Edit Article';
        $labels->new_item = 'New Article';
        $labels->view_item = 'View Article';
        $labels->search_items = 'Search Articles';
        $labels->not_found = 'No Articles found';
        $labels->not_found_in_trash = 'No Articles found in Trash';
        $labels->all_items = 'All Articles';
        $labels->menu_name = 'Articles';
        $labels->name_admin_bar = 'Articles';
    }
    add_action( 'admin_menu', 'yourprefix_change_post_label' );
    add_action( 'init', 'yourprefix_change_post_object' );
    

    you can refer to this article for more details.