How do I remove All and Published if not admin?

responding to code added by OP replace post with the slug of your post type. add_filter(‘views_edit-SLUG_OF_YOUR_POST_TYPE’, function($views) { … So a custom post type of Library Books with a slug of library-books: add_filter(‘views_edit-library-books’, function($views) {… original response Use $wp_roles->remove_cap( $role, $cap ); on all roles except the admin, removing the edit_others_posts cap. See this for … Read more

Single category’s posts list in admin menu

The best approach would be to create a custom post type “News” and hide the menu item of “posts” – The code below will create a Custom post type for news /* * Creating a function to create our CPT */ function custom_post_type() { // Set UI labels for Custom Post Type $labels = array( … Read more

Disable the “Skip to Toolbar” tabbing accessibility feature

It’s not possible without JavaScript. The HTML for it is output in the WP_Admin_Bar in a private and protected method with no filter. You can remove them after the page has loaded with JS like so: function wpse_287259_remove_skip_link() { echo “<script>jQuery( ‘.screen-reader-shortcut’ ).remove();</script>”; } add_action( ‘wp_after_admin_bar_render’, ‘wpse_287259_remove_skip_link’ ); I hope it goes without saying that … Read more

How do I add a contact form?

There are many free and paid plugins you can activate to do this quickly and easily. Contact Form 7, Ninja Forms, and Caldera Form are very popular but there are many more. Just go to the WP Dashboard Plugin > Add New > Search for Contact Forms > Install > Activate > Go to Plugin … Read more

admin_enqueue_scripts not working

If you remove that conditional in the first line of the enqueue function, your scripts should load. I can’t see the broader context of why your function is written that way, but if you just copied it from a tutorial or something, you don’t need it here. Try: <?php function sunset_load_admin_scripts(){ wp_enqueue_media(); wp_register_script(‘sunset-admin-script’,get_template_directory_uri() .’/js/news_admin.js’, array(‘jquery’), … Read more

Admin multiple column sorting

Since WordPress already allows for the sorting of page titles alphabetically (either ascending or descending order), all that is actually needed is to add an Author filter. This can be achieved by adding the following to the functions.php file of your active theme: function rudr_filter_by_the_author() { $params = array( ‘name’ => ‘author’, // this is … Read more

creating custom rewrite rules for admin pages

How would I setup a custom rewrite rule to redirect /wp-admin/(page-slug).php to /wp-admin/admin.php?page=(page-slug) You can’t, WP Admin doesn’t make use of the rewrite rules system like the frontend, so rewrite rules have no effect on WP Admin pages. You can only use WP rewrite rules to map pretty URLs on to versions that take the … Read more

Can I mass change all admin emails for a multisite instance?

Okay so thanks to the suggestion from Rup I got this to work and apply to all my sites locally (will double check this before using on live!) $blogs = get_sites([‘public’ => 1, ‘orderby’ => ‘registered’, ‘order’ => ‘DESC’, ‘number’ => 1000]); foreach($blogs as $blog) { $bid = $blog->blog_id; switch_to_blog($bid); update_option( ‘admin_email’, ‘[email protected]’ ); update_option( … Read more