• Hi Every one,

    I recently register to WordPress.org and this is my first topic. I want to add an option in the action drop down for pages and post in the WordPress admin section, so I can make the page or post publish or unpublished.
    see the screen shot: http://screencast.com/t/2U46h1jBjy

    Is there a way I can add an action function to add that option and execute it ?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi roh4iitt,

    You don’t need to add anything to the menu at the top to do what you want. Tick the checkbox to the left of each page/post in the list that you want to publish or unpublish. Once you have the pages selected go to the drop down at the top and select ‘Edit’ and click the ‘Apply Button’.

    You’ll be presented with the ‘Bulk Edit’ screen. (see screenshot here => http://en.support.wordpress.com/posts/edit-posts-screen/#bulk-edit).

    Change the ‘Status’ with the appropriate drop down selector and click ‘Update’. This will update the status in the database and you should be good to go.

    Thread Starter roh4iitt

    (@roh4iitt)

    Hi trishasalas,

    Thanks for you reply. I know the way you trying to explain. But I need to do it that way, I am sure there should be a way where we can add more option in Apply drop down.

    I will look for you reply.

    Thanks

    Hi, I don’t know if adding an action is possible, since in WP 3.6.1 in /wp-admin/includes/class-wp-list-table.php in bulk_actions method of WP_List_Table class, there this note

    // This filter can currently only be used to remove actions.

    so apparently it’s not possible and is proven by the code below:

    /**
     * Remove "Edit" option. Will not add a "Some Action" action.
     * @param $actions
     * @return mixed
     */
    function custom_tr_edit_post_bulk_actions( $actions ) {
    	// Remove Edit
    	unset( $actions['edit'] );
    	// Can't add new action
    	$actions['someaction'] = __('Some Action', 'yourlangdomain');
    	return $actions;
    }
    add_filter('bulk_actions-edit-post', 'custom_tr_edit_post_bulk_actions');

    Anyway, maybe somebody has an alternative answer but in any case, as Trisha pointed it, it’s not actually necessary since you have bulk quick edit and you can set the publish status there, however, I understand that you might want to do this to make it easier for a client.
    Good luck!

    tag is supported in all major browsers

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add an option in Pages Action drop down’ is closed to new replies.