Remove Admin sidebar link
function remove_featured_tax_menu() { remove_submenu_page( ‘edit.php?post_type=movies’, ‘edit-tags.php?taxonomy=featured&post_type=movies’ ); } add_action( ‘admin_menu’, ‘remove_featured_tax_menu’ );
function remove_featured_tax_menu() { remove_submenu_page( ‘edit.php?post_type=movies’, ‘edit-tags.php?taxonomy=featured&post_type=movies’ ); } add_action( ‘admin_menu’, ‘remove_featured_tax_menu’ );
This is a known limitation by the WordPress menu functions, you would need to rekey all of the menus ahead of time to be +100 or whatever you need, before Pods adds the menus to fix this. Previous versions of WordPress had a bigger problem with this, but they recently increased it in the past … Read more
You can check out this excellent answer by @Eugene Manuilov. In your case the relevant admin page action is: load-appearance_page_customstyle and the url to the custom stylesheet you want to edit: get_admin_url().’theme-editor.php?file=custom-stylesheet.css&theme=”. get_stylesheet().”&scrollto=0′; Then your code example would be: add_action(‘admin_menu’, ‘add_appearance_menu’); function add_appearance_menu() { add_submenu_page( ‘themes.php’, ‘Custom Stylesheet’, ‘customstyle’, ‘manage_options’, ‘customstyle’, ‘__return_null’); } add_action( ‘load-appearance_page_customstyle’, … Read more
Simply use add_query_arg(), remove_query_arg() and get_query_var(). On your page link, you use a simple query var like step=one. $query_arg = add_query_arg( ‘step’, ‘one’, $_SERVER[‘REQUEST_URI’] ); Then, when the user processed the form, you just reload the page. Then simply check if 0 !== get_query_var( ‘step’ ) AND ‘one’ !== get_query_var( ‘step’ ) and process further. … Read more
The easiest and most clean way to solve that problem is using a specialised object. First create a class that can hold extra information: class Menu_Page { public $extra=””; public function render() { print $this->extra; } } Now create an object from that class … $page = new Menu_Page; $page->extra=”Hello World!”; … and register its … Read more
Insert the URL of the page as the $menu_slug argument. Also note that user levels are deprecated, you should pass a capability instead. function add_custom_link() { add_submenu_page( ‘edit.php?post_type=cpt_custom’, ”, ‘Pending Posts’, ‘edit_posts’, ‘edit.php?post_type=cpt_custom&post_status=pending’, ” ); } add_action(‘admin_menu’, ‘add_custom_link’);
The two are not the same thing at all, and likely you’ll use both. The Administration Menu stuff shows you how to create the menu item and page for your settings to live on. In other words, the menu item in the left hand bar, and the existence of the page itself. The Settings API … Read more
You could use the posts_clauses filter: function wpse155797_posts_clauses( $pieces, $query ) { if ( ! is_admin() || ! $query->is_main_query() ) { return $pieces; } global $wpdb; if ( ( $orderby = $query->get( ‘orderby’ ) ) == ‘asset_type’ ) { if ( ( $order = strtoupper( $query->get( ‘order’ ) ) ) != ‘DESC’ ) $order=”ASC”; $pieces[ … Read more
According to the documentation for add_menu_page: Note: If you’re running into the “You do not have sufficient permissions to access this page” error, then you’ve hooked too early. The hook you should use is admin_menu. This means you need to wrap your menu creation in something like: add_action( ‘admin_menu’, function() { add_menu_page( // page title … Read more
You need to “hook” it to an action, in this case admin_menu: add_action( ‘admin_menu’, ‘remove_admin_menus’ ); Just place it right after the function.