Add a button at the WordPress Backend Pages menu

Hi everybody I am wondering how I can make a button to edit the page content with the WordPress backend, like Visual Composer does. I could not find any code to insert a simple button to edit a page with my own plugin.

Picture of the WordPress Backend with Visual Composer

Read More

In this picture you can see the two blue buttons, I can not create.

Related posts

1 comment

  1. I don’t know if you are familiar with WordPress Hooks, but hooks are the magic of how things like this are done in WordPress.

    The particular hook you are looking for is this:

    do_action( 'edit_form_after_title', $post );
    

    The hook above is called in the WordPress “edit” interface (in file wp-admin/edit-form-advanced.php.

    If you want to do something at that location, then you need to access that hook by adding an action:

    So, your code (in your plugin) would look something like this:

    // Tells WP to do something at the do_action mentioned above
    add_action( 'edit_form_after_title', 'my_function_name');
    
    // This is the function specified in the "add_action" above
    function my_function_name( $post ) {
       // Do stuff here.
       echo '<a href="#" class="button-primary">My Button</a>';
    }
    

    Hope this helps!

Comments are closed.