Admin menu as submenu from another plugin

Trying to simulate the issue, it happened the same (wp-admin/submenu_slug), and the solution is to add a priority value in the hook admin_menu. Here, I’m adding a sub menu to the plugin BackWPup. Note the priority 11: add_action(‘admin_menu’, ‘third_party_submenu_wpse_91377’, 11 ); function third_party_submenu_wpse_91377() { add_submenu_page( ‘backwpup’, // Third party plugin Slug ‘My plugin’, ‘My plugin’, … Read more

How to influence the information displayed on widget inside wp-admin

Background: The reason why filtering with dynamic_sidebar_params doesn’t work with HTML is because WordPress strips HTML from Widget Heading in wp_widget_control() function like this: $widget_title = esc_html( strip_tags( $sidebar_args[‘widget_name’] ) ); WordPress also strips HTML in default JavaScript in wp-admin/js/widgets.js So without a customised solution, there is no default filter or option either with PHP … Read more

How to search post by ID in wp-admin

Solution 1 Here’s a solution that uses pre_get_posts action to override the original search query and search by post ID instead. This is the approach that I would generally recommend. /** * Allows posts to be searched by ID in the admin area. * * @param WP_Query $query The WP_Query instance (passed by reference). */ … Read more

js error on post editing page

I’d suggest disabling script concatenation and/or compression to see if that helps. You can do this by adding the following to the wp-config.php file: define( ‘CONCATENATE_SCRIPTS’, false ); define( ‘COMPRESS_SCRIPTS’, false ); And maybe even script debugging to.. define( ‘SCRIPT_DEBUG’, true ); Are you using any caching plugins? EDIT: The most common reason for seeing … Read more

Restrict admin access to certain pages for certain users

This code seems to work well for me (in functions.php): $user_id = get_current_user_id(); if ($user_id == 2) { add_filter( ‘parse_query’, ‘exclude_pages_from_admin’ ); } function exclude_pages_from_admin($query) { global $pagenow,$post_type; if (is_admin() && $pagenow==’edit.php’ && $post_type ==’page’) { $query->query_vars[‘post__not_in’] = array(‘123′,’234′,’345’); } }

Add header and footer to WP backend

The in_admin_header action may be used to insert content before <div id=”wpbody”> in the wordpress backend. See Line 101 of /wp-admin/admin-header.php (line number as of version 3.3.2) Further reading on actions: Action Reference, codex