Tag Info

Hot answers tagged

2

Use in_array(): if ( in_array( $hook, [ 'user-edit.php', 'profile.php' ] ) ) // do something Or wait for the action personal_options, and enqueue the script for the footer. This action is fired in both cases. See this old example.


2

Use get_current_blog_id() to check the current site. To run on site 2 only, use this: function new_meta_values($order_id) { if ( 2 !== get_current_blog_id() ) return; /* the rest of the function code */ }


2

Unfortunately, there is no 'filter' to remove or edit the previous items in the 'At Glance' box. EDIT I removed the "Wordpress Core Hack" part because I don't want to encourage such a behavior, and I don't want you to edit the code every time Wordpress releases a new version :) And here is a code to append custom post types stats without being clickable : ...


1

The dashboard_glance_items filter is only useful for modifying the extra elements. The posts/comments data elements have already been displayed. Here are three ideas: Method #1 - Use the dashboard_glance_items filter: You can use the following filter setup, to remove the posts/pages/comments elements from the output of wp_dashboard_right_now(). The ...


1

I think best hook should be 'template_redirect', when this hook is fired main query is already set, so you can look at queried object and if the user has no required capability you can redirect request somewhere: add_action( 'template_redirect', function() { if ( ( is_category( 'special-category' ) || is_singular() && has_category( ...


1

For this, you have to use user_register hook defined on wp-includes/users.php line 1759. personal_options_update hook is called, when an user updating his own profile. edit_user_profile_update is called, when an administrator updating other user profile. nothing is called, when an administrator creating a new user. On user-new.php page, new user are ...



Only top voted, non community-wiki answers of a minimum length are eligible