New answers tagged

-1

add_action( 'admin_menu', 'dashboard_remove_menu_pages' ); function dashboard_remove_menu_pages() { remove_submenu_page( 'themes.php', 'nav-menus.php' ); add_menu_page('Menu', 'Menu', 'edit_themes', 'nav-menus.php', '' , 'dashicons-menu', 3); } this should work. also with the positioning. in this case menu position: 3. just abide to ...


0

A quick Google Search gave me several results and I managed to find an easy solution. The code below is from Easy Web Design Tutorial website but I will paste it below in case that link ever breaks. function reorder_admin_menu( $__return_true ) { return array( 'index.php', // Dashboard 'edit.php?post_type=page', // Pages '...


1

There's a combination of two filters, menu_order does the job, but you also use custom_menu_order to enable menu_order. function wpse_233129_custom_menu_order() { return array( 'index.php', 'upload.php' ); } add_filter( 'custom_menu_order', '__return_true' ); add_filter( 'menu_order', 'wpse_233129_custom_menu_order' ); This will put upload.php (the ...


2

That area of all admin screens is where admin notices are displayed, so you could generate an admin notice. Here's a suitable function and hook: function wpse_233031_admin_notice() { ?> <div class="notice notice-info"> <p>Your message here!</p> </div> <?php } function wpse_233031_hook_admin_notice() { ...


0

Try auto_core_update_email. E.g: add_filter('auto_core_update_email', function($email, $type, $core_update, $result) { if ('success' === $type) $email['body'] = sprintf( __('Congratulation! Your site at %1$s has been updated automatically to WordPress %2$s.', 'textdomain'), home_url(), $core_update->current ) . "\n\n"; return $email; }, ...


0

You need the attachment ID - which is the same as the "thumbnail ID" - not the post ID. It's confusing. Maybe by WP 5.0 they'll update the nomenclature! So, I think this'll work: function attached_image_content( $column_name, $post_ID ) { if ( $column_name == 'foobar' ) { //Change the image size from default 'thumbnail' here $...


0

I had the same problem, to fix it I used wp_die() at the end of my function just after an echo. Don't forget to pass your action on your script. To be sure, check if your function has to use wp_ajax_nopriv like wp_ajax.


0

Turns out that it is possible to run a WP_Query inside a pre_get_posts action keeping in mind two simple principles: pre_get_posts action will alter every query that you make, so you need to contain its action specifying which queries you need to alter. In this case, this containment is done with this line: if ( is_admin() and !current_user_can('...


1

You're using $post->ID which is undefined. Try $_GET['post'] instead: // Get Categories if ( is_admin() && isset($_GET['post']) ) { $cats = wp_get_post_categories( (int)$_GET['post'], array( 'fields' => 'all' ) ); $cats = wp_list_pluck( $cats, 'slug' ); foreach ( $cats as $cat ) { $classes .= ' category-' . $cat; } }


0

If you browse through the source code of the function you'll find this: $keys = apply_filters( 'postmeta_form_keys', null, $post ); if ( null === $keys ) { ... } Using the postmeta_form_keys hook you can manually specify the keys to avoid calling this inefficient query altogether: add_filter('postmeta_form_keys', function(){ return ['...


0

We may need a little more information on the version of WordPress you are running, or at least the interface you are seeing that the new admin is not seeing. Typically, when I troubleshoot WordPress installations and I have to add an administrator, I have full access just like an admin. So, it shouldn't be any different for you. Make sure that the role of ...


4

Have a look at the Network Admin Settings screen (in my installation, it's at example.com/wp-admin/network/settings.php). Tucked away down near the bottom is this: Menu Settings Enable administration menus [] Plugins Checking that box should allow your users to see the Plugins menu in their sites' back end. (I don't think it'll allow them to ...


0

Try this - it worked for my situation - add_submenu_page( WP_PLUGIN_DIR . '/multisite-super-admin/includes/admin/settings.php', "Plugins", 'Plugins', 'administrator', '/plugins.php', '') ; The URL there is to a plugin I wrote. so you will want to add this to your own plugin. Very straight forward. Learn more about it here - https://codex.wordpress.org/...


0

I made the database changes as instructed but when I signed in as an administrator I still could'nt alter users or pages. When comparing the database field for user roles I noticed it was different from other Wordpress installations. My solution was this: Find the field named "wp_user_roles" in the table named [database prefix]_options, e.g. "wp_options", ...


0

By default, WordPress posts set to private are visible to admins, and you can distinguish them on the frontend because they have 'Private:' prepended to their title. However, you might have plugins installed that are modifying this behaviour. It could be your capability management plugin, or it could be WooCommerce. The specifics of third-party plugins are ...


-1

I found out the problem. i used wp_update_user to create the user, instead of wp_create_user. my bad :/


1

@bravokeyl is the probably the best answer to your immediate problem. But to address the following: Is there a way to hook into an action or filter and remove ALL the update nag messages for non-admin users? No. Nag messages in WordPress are just a callback to added to the admin_notices hook which print some HTML to the page. They are practically ...


7

In wp-admin/includes/update.php file if ( current_user_can('update_core') ) $msg = sprintf( __('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'), 'update-core.php' ); else $msg = __('An automated WordPress update has failed to complete! Please notify the site ...



Top 50 recent answers are included