Custom user role that can only edit specific (non-custom-type) page and all child pages [duplicate]

There’s no way in WordPress to assign the capability for editing (or any action) a specific post to a role. However, you can filter capabilities checks and change them on the fly using the map_meta_cap. When handling post permissions, WordPress ultimately deals in just 4 capabilties: edit_post read_post delete_post publish_post Then whenever an action is … Read more

Remove Pagination in Appearance -> Menus -> Categories

As per Stackoverflow Stackoverflow Ok after reading through the source code I found that the number of categories returned in the edit menu section is hardcoded to 50 on line 613 of \wp-admin\includes\nav-menu.php // Paginate browsing for large numbers of objects. $per_page = 50; $pagenum = isset( $_REQUEST[$taxonomy_name . ‘-tab’] ) && isset( $_REQUEST[‘paged’] ) … Read more

How do I create a new WP admin color scheme?

This code works with WordPress 5.2 and is correct. You now need to go to your Profile and select it by going to Users > Your Profile > Admin Color Scheme select the scheme and save. Edit: Adding updated code for your colors CSS file since you’re using a child theme: function additional_admin_color_schemes() { wp_admin_css_color( … Read more

Is it possible to add an admin page using add_submenu_page() and pass a var in the query string?

Your menu slug (5th parameter) can’t be the same across multiple pages, and it obviously can’t have an & in it, but you can have all the pages you want call the same callback function (the last param). add_submenu_page(‘upload_manage’, “Programs”, “Programs”, ‘manage_options’, ‘manage-programs’, “manage_data”); add_submenu_page(‘upload_manage’, “Schedule”, “Schedule”, ‘manage_options’, ‘manage-schedule’, “manage_data”); Then in the manage_data function, … Read more

How can I add a set featured image function to a theme that doesn’t already have it built in?

You can add this line to your functions.php file to add the post thumbnail option to all post types: add_theme_support( ‘post-thumbnails’ ); If you want it for only one post type, you pass an array of post type names as second argument: add_theme_support( ‘post-thumbnails’, array( ‘post’ ) ); #shown in posts only To display the … Read more

Best way to filter featured image text for a custom post type?

Regardless if you go the PHP or jQuery route, I suggest you set up your filters or enqueue your Javascript in the admin_head-post[-new].php or admin_print_scripts-post[-new].php hook. There you can be sure that the global variable $post_type is set, and can check whether it is slide. Since the post thumbnail code is called after these hooks, … Read more

Hide/Show only specific categories in wp-admin new-post.php

Something like this should do it. Replace wpse_77670_getPermittedCategories() with however you select the array of permitted categories, and ‘your_custom_category’ with whatever your custom taxonomy is for your custom post type. /** * filter terms checklist args to restrict which categories a user can specify * @param array $args arguments for function get_terms() * @param array … Read more

How to make custom bulk actions work on the media/upload page?

If you want to use your code, try this: If you want to check if the medias are attachments, you can try to use $_REQUEST[‘detached’] add_action( ‘load-upload.php’, ‘export_media_test’ ); function export_media_test() { if ( ! isset( $_REQUEST[‘action’] ) ) return; echo ‘Export Media’; if ( isset( $_REQUEST[‘detached’] ) ) { die( ‘No attachments’ ); } … Read more

How to create sub menu with a URL parameter?

You’d have to manipulate the global $submenu and modify the link in it. Or use jQuery. The following example adds a submenu in the Dashboard menu and changes the destination link just after. The submenu page will dump the contents of the global var. add_action( ‘admin_menu’, function() { add_submenu_page( ‘index.php’, ‘Sandbox Options’, ‘Options’, ‘administrator’, ‘sandbox_options’, … Read more