WordPress.org

Ready to get started?Download WordPress

Forums

Customise the standard add post/page screen (2 posts)

  1. jpadie
    Member
    Posted 5 years ago #

    I know that i can easily create my own post/page screen but is anyone aware of a hook that allows the customisation of the _standard_ post/page screen? both edit and new.

    essentially i want to remove a number of the boxes.

    thanks
    Justin

  2. jpadie
    Member
    Posted 5 years ago #

    solution found.

    <?php
    /*
    Plugin Name: removeMetaBoxes
    Plugin URI: http://rathercurious.net
    Description: Allows core meta boxes to be removed
    Author: Justin Adie
    Version: 1.0
    Author URI: http://rathercurious.net
    */
    
    class removeMetas{
    	public function __construct(){
    		add_action('do_meta_boxes', array($this, 'removeMetaBoxes'), 10, 3);
    	}
    
    	public function removeMetaBoxes($type, $context, $post){
    		/**
    		 * usages
    		 * remove_meta_box($id, $page, $context)
    		 * add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default')
    		 */
    		$boxes = array(	'slugdiv', 'postexcerpt', 'passworddiv', 'categorydiv',
    						'tagsdiv', 'trackbacksdiv', 'commentstatusdiv', 'commentsdiv',
    						'authordiv', 'revisionsdiv', 'postcustom');
    
    		foreach ($boxes as $box){
    			foreach (array('link', 'post', 'page') as $page){
    				foreach (array('normal', 'advanced', 'side') as $context){
    					remove_meta_box($box, $type, $context);
    				}
    			}
    		}
    	}
    }
    
    $removeMetas = new removeMetas();
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic