Tag Info

Hot answers tagged

33

Here's the process to change the labels (I changed posts to "contacts" in my example) function change_post_menu_label() { global $menu; global $submenu; $menu[5][0] = 'Contacts'; $submenu['edit.php'][5][0] = 'Contacts'; $submenu['edit.php'][10][0] = 'Add Contacts'; $submenu['edit.php'][15][0] = 'Status'; // Change name for categories ...


27

I coded a plugin just for that and never got around to publish it : Usage: In the dropdown you have a list of all custom fields, so just select the field you want to filter by and click filter. if you want to filter to a specific value of a custom field then select the field's name , enter the value you want and click filter. <?php /* Plugin Name: ...


23

Another solution is to add the columns setting back to the settings. function wpse126301_dashboard_columns() { add_screen_option( 'layout_columns', array( 'max' => 2, 'default' => 1 ) ); } add_action( 'admin_head-index.php', 'wpse126301_dashboard_columns' ); There is a related Trac ...


12

To hide a post type menu item from non-admin users: function wpse28782_remove_menu_items() { if( !current_user_can( 'administrator' ) ): remove_menu_page( 'edit.php?post_type=your_post_type' ); endif; } add_action( 'admin_menu', 'wpse28782_remove_menu_items' ); your_post_type should be the name of your actual post type. EDIT- other menu ...


12

grep wp_version wp-includes/version.php


9

Yes, there are several actions within that widget, including right_now_content_table_end. Example: function my_right_now() { $num_widgets = wp_count_posts( 'widget' ); $num = number_format_i18n( $num_widgets->publish ); $text = _n( 'Widget', 'Widgets', $num_widgets->publish ); if ( current_user_can( 'edit_pages' ) ) { $num = ...


8

Though the user_contactmethods filter is the one of the few for the user profile screen, since the other fields are not required in WordPress, you could use jQuery's .hide() and .remove() to effectively get rid of the ones you don't want without complications in terms of saving the information. Sure, a person without JS on would still see them, but that's a ...


8

I use a custom include file that I created to modify the dashboard. Some of the hooks and filters are commented out by default but most of the stuff is here to remove menus, change wp logos, remove meta boxes, remove dashboard widgets, etc... <?php /* File: cleanup-dashboard.php Description: Clean up and customize the dashboard Author: Chris Olbekson ...


8

Actually, it is not that hard. The last access time for a user is in get_user_meta( get_current_user_id(), 'last_access', TRUE ). The date of each comment is in the column comment_date. Both share the same format, so we can compare them in SQL with a simple >. There is an action in the Right Now dashboard widget to show additional rows: ...


7

Updating this answer the original code below will remove the nag screen but it will ping the server for updates on every load, thanks to @ El Yobo, see update below. This will disable the core updates and the nag screen to everyone but superadmins. add_action( 'after_setup_theme', 'remove_core_updates' ); function remove_core_updates() { if ( ! ...


7

Almost the same approach One Trick Pony has chosen, but I am using translated names and uasort() (to preserve the keys): add_filter( 'editable_roles', 't5_sort_editable_roles' ); /** * Array of roles. * * @wp-hook editable_roles * @param array $roles * @return array */ function t5_sort_editable_roles( $roles ) { uasort( $roles, ...


7

As far as ease of use, especially for WordPress Admins not too firm in PHP, I second brasoflo's plugin recommendation (Adminimize). For the sake of completeness, this is how it'd be done programmatically: /* Remove the "Dashboard" from the admin menu for non-admin users */ function wpse52752_remove_dashboard () { global $current_user, $menu, $submenu; ...


6

Whenever we find ourselves in the situation "there must be a way to overcome this hard-code", jQuery comes to rescue... The Result The Code The following code must be pasted at the end of the active Theme functions.php file. Or it can be used in a custom plugin, which will make the code "theme-independent". add_action('admin_head-index.php', ...


6

For the contact methods filter: user_contactmethods. add_filter( 'user_contactmethods', 'update_contact_methods',10,1); function update_contact_methods( $contactmethods ) { unset($contactmethods['aim']); unset($contactmethods['jabber']); unset($contactmethods['yim']); return $contactmethods; }


6

You're right - it doesn't. Neither does the wp_add_dashboard_widget function. So just use the generic add_meta_box and indicate dashboard and placement: add_action( 'wp_dashboard_setup', 'my_dashboard_setup_function' ); function my_dashboard_setup_function() { add_meta_box( 'my_dashboard_widget', 'My Widget Name', 'my_dashboard_widget_function', ...


6

To lock subscribers and contributors out of the admin: function wpse23007_redirect(){ if( is_admin() && !defined('DOING_AJAX') && ( current_user_can('subscriber') || current_user_can('contributor') ) ){ wp_redirect(home_url()); exit; } } add_action('init','wpse23007_redirect'); Hope that helps. All roles give the user a ...


6

Based on this same code, you may use this to show every custom post types and custom taxonomies count : // Add custom taxonomies and custom post types counts to dashboard add_action( 'right_now_content_table_end', 'my_add_counts_to_dashboard' ); function my_add_counts_to_dashboard() { // Custom taxonomies counts $taxonomies = get_taxonomies( array( ...


6

you can create a function that redirects to the front-end like this: function redirect_home_987(){ wp_redirect( home_url() ); exit; } and call that function in WordPress default add_menu_page function like this: add_menu_page( 'redirecting', 'View Site', 'read', 'my-top-level-handle', 'redirect_home_987'); Hope this helps


6

Wordpress SEO If you want to remove the admin menu: you can do that with: function hide_wpseo() { remove_action('admin_menu', 'zeo_options_menu'); } add_action( 'init', 'hide_wpseo'); where it will be removed for all users. WordPress SEO by Yoast To hide the admin menu: and the admin menu bar: one can use: function hide_yoastseo() { ...


6

This happens because of the new media queries. A very unfortunate change … Anyway, you can change it by setting a custom width for .postbox-container. Use 50% for two columns and 100 % for just one column. add_action( 'admin_head-index.php', function() { ?> <style> .postbox-container { min-width: 100% !important; } ...


5

Seems like there is no filter for this (yet), but you can unregister the default activity widget and register (within your functions, or even better within your plugin as recommended by Dave Warfel) a similar activity widget with your custom settings: // unregister the default activity widget add_action('wp_dashboard_setup', 'remove_dashboard_widgets' ); ...


5

add_action( 'load-index.php', 'the_function', 1, 0 ); The load-{page_hook} hook works with the filename of the page to load.


5

Hi @Relequestual: I think what you want is here: Dashboard Widgets API / Advanced: Forcing your widget to the top It doesn't require you to change code per se, just to add the code like shown in the WordPress Codex to your theme's functions.php file which is a standard way to customize and/or extend WordPress: To find out the values you need use, ...


5

You can also just go to http://site.url/readme.html in a web browser. The readme file ships with every version of WordPress and displays the installed version number prominently at the top of the page. Also, if you can view your site's front-end (I know you said you can't access the dashboard, so I'm just assuming your blog is public), you can "view ...


5

The incoming links widget is asking Google for links to the domain you’re on right now. If your domain is localhost you get a lot of links – because that’s a very common domain name. Unfortunately, some people don’t clean up their data when they move from localhost to the world wide web, and then Google will find these links. :) Nothing to worry about.


4

Use this small plugin, also available on Gist: https://gist.github.com/1503172 Works fine and is also a part of the plugin free "Adminimize". add_action( 'init', 'fb_remove_admin_bar', 0 ); function fb_remove_admin_bar() { wp_deregister_script( 'admin-bar' ); wp_deregister_style( 'admin-bar' ); remove_action( 'init', '_wp_admin_bar_init' ); ...


4

In your theme's functions.php: function hide_the_dashboard() { global $current_user; // is there a user ? if(is_array($current_user->roles)) { // substitute your role(s): if(in_array('custom_role', $current_user->roles)) { // hide the dashboard: remove_menu_page('index.php'); } } } ...


4

In you PhpMyAdmin query for: (if you have a different database prefix, change that in the query, also change the user_id to yours) SELECT * FROM `wp_usermeta` WHERE `user_id` =1 AND `meta_key` LIKE 'meta-box%' Than delete those values and you will get the original order back. If you only want to change the menu order back for a page than only delete ...


4

I don’t know how to move the notices to the bottom or if that’s possible at all. To disable the debug mode in wp-admin write in wp-config.php: define( 'WP_DEBUG', FALSE === strpos( $_SERVER['REQUEST_URI'], '/wp-admin/' ) ); Untested: You could try to enable warnings in admin with: // happens early in wp-admin/admin.php add_filter( ...


4

First, try disabling all of your plugins, and see if that fixes it. If it does, enable them one at a time until you are able to reproduce the error. That should tell you which plugin is causing the problem. Additionally, I strongly suggest you upgrade to 3.0.1.



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