WordPress.org

Ready to get started?Download WordPress

Forums

Page Links To
Remove Meta Box for Author user roles (2 posts)

  1. nellone
    Member
    Posted 1 year ago #

    I'm trying to remove the plugin metabox for author user roles from edit.php page... i can do it for all other metaboxes but page-links-to.

    this is the code

    if ( current_user_can('author') )
    {
    
    	function my_remove_meta_boxes()
    	{
    		remove_meta_box('postexcerpt', 'post', 'normal');
    		remove_meta_box('trackbacksdiv', 'post', 'normal');
    		remove_meta_box('postcustom', 'post', 'normal');
    		remove_meta_box('revisionsdiv', 'post', 'normal');
    		remove_meta_box('commentstatusdiv', 'post', 'normal');
    		remove_meta_box('commentsdiv', 'post', 'normal');
    		remove_meta_box('slugdiv', 'post', 'normal');
    		remove_meta_box('tagsdiv-post_tag', 'post', 'side');
    		remove_meta_box('categorydiv', 'post', 'side');
    		remove_meta_box('postimagediv', 'post', 'side');
    
    		remove_meta_box('page-links-to', 'post', 'normal');
    
    	}
    	add_action( 'do_meta_boxes', 'my_remove_meta_boxes' );

    in plugin's source code i found this:

    function do_meta_boxes( $page, $context ) {
    		// Plugins that use custom post types can use this filter to hide the PLT UI in their post type.
    		$plt_post_types = apply_filters( 'page-links-to-post-types', array_keys( get_post_types( array('show_ui' => true ) ) ) );
    
    		if ( in_array( $page, $plt_post_types ) && 'advanced' === $context )
    			add_meta_box( 'page-links-to', 'Page Links To', array( $this, 'meta_box' ), $page, 'advanced', 'low' );
    	}

    but i cannot anyway to detect a working hook to remove the metabox.

    thanks for help!

    http://wordpress.org/extend/plugins/page-links-to/

  2. cgpetersen
    Member
    Posted 11 months ago #

    I don't know if you're still looking for an answer to this, but this is what worked for me:

    remove_meta_box( 'page-links-to', 'post', 'advanced' );

    The $context for Page Links To is 'advanced'. If you have a custom post type replace "post" with the name of the post type.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic