Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now
60

I was able to fix the error by hotfixing the RevSlider plugin on my server as documented here. In revslider/includes/framework/base-admin.class.php, I changed the following line (l. 21 of my version) from: private static $arrMetaBoxes = ''; //option boxes that will be added to post to: private static $arrMetaBoxes = array(); //option boxes ...


38

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 ...


30

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 ticket: #...


22

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 "...


15

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


14

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; ...


13

To achieve adding a custom sortable column to the WP_List_Table of your post type within the WordPress administration back-end dashboard, you will need to do the following: Replace all occurrences of YOUR-POST-TYPE-NAME with your actual post type name. Replace all occurrences of YOUR-TAXONOMY-NAME with your actual taxonomy name. Replace all occurrences of ...


12

You have some messed up code. I have reformatted your code to code which actually works. The following solution allows you to give your Custom Post Type menu a menu name of what ever you want. Just change the label "menu_name". POST TYPE // Create the news custom post type register_post_type('nwcm_news', array( 'labels' => array( '...


10

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' ); } ...


9

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 ...


9

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 ( ! ...


9

You have to give the capability a true or false, like this: add_role('user', 'User', array( 'read' => true )); To fix it, first remove the role and than re-add it again. remove_role('user'); add_role('user', 'User', array('read' => true)); http://codex.wordpress.org/Function_Reference/add_role


8

To rename default post type (or any other for that matter) just use filter post_type_labels_{$post_type}. For default post it will be post_type_labels_post. In the code below is the full list of labels (WP 4.7.1). You do not have to change everything. add_filter( 'post_type_labels_post', 'news_rename_labels' ); /** * Rename default post type to news * * @...


8

The best way is to re-direct user logins to your page and also remove the dashboard from the menu, this can be done with 2 filters. Redirect logins to your page edit screen example based on user roles, this example uses "author": function dashboard_redirect($url) { global $current_user; // is there a user ? if(is_array($user->roles)) { ...


8

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; } .meta-box-sortables.ui-...


8

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' ); ...


8

Here is the function that I use to display CPT in the "At a glance" widget add_action( 'dashboard_glance_items', 'cpad_at_glance_content_table_end' ); function cpad_at_glance_content_table_end() { $args = array( 'public' => true, '_builtin' => false ); $output = 'object'; $operator = 'and'; $post_types = ...


8

If you want to remove metaboxes from the dashboard page you can add this to functions.php function remove_dashboard_widgets () { remove_meta_box('dashboard_quick_press','dashboard','side'); //Quick Press widget remove_meta_box('dashboard_recent_drafts','dashboard','side'); //Recent Drafts remove_meta_box('dashboard_primary','dashboard','side'); //...


7

I use this command to find all installs of WordPress on my VPS server find /home/*/public_html/ -type f -iwholename "*/wp-includes/version.php" -exec grep -H "\$wp_version =" {} \; Its a really quick way to find out which accounts are out of date.


7

This is how you remove DASHBOARD on your Wordpress fully ! For who don't want to use plug-in(s), If you installed a plug-in for remove that. You will get extra menu about that plug-in also. What the point ? So you should have control what you do/did Insert codes on functions.php Redirect : (When user go to url like domain.com/wp-admin) function ...


7

Easy enough, decided to just do the redirect option. I used the wp_login action hook. You could also probably use this for redirecting your users to ANY page on your website. You can also check user capabilities from the $user Object passed in as a function parameter if you want to send different user levels to different pages. /* Redirect the user logging ...


7

From this Q&A, I've learned about the global variable $wp_meta_boxes. And over there is also the code to remove the default meta boxes. After examining the variable, this is the code I wrote to remove all Dashboard Widgets, including the ones added by plugins: add_action('wp_dashboard_setup', 'wpse_73561_remove_all_dashboard_meta_boxes', 9999 ); ...


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

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

Check if you or a plugin include bootstrap and the bootstrap CSS / Theme files. Bootstraps .hidden class looks like: .hidden { display: none !important; } But overrides wordpress' definition of .hidden: .hidden { display: none; } The Top 'Help' & 'Screen Options' bars are displayed via inline style display: block, which is overridden by ...


7

It's simple, just unregister postexcerpt box first then add another one on the top. Here is my code add_action( 'admin_menu', function () { remove_meta_box('postexcerpt', 'post', 'normal'); }, 999 ); add_action('edit_form_after_title', 'post_excerpt_meta_box');


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

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


6

You don’t need to invent a new screen option row. Just use proper metaboxes. Currently, you are drawing pseudo-metaboxes: <!-- Post status start--> <div class = "postbox"> <div class = "handlediv"> <br> </div> <h3 class = "hndle"><span><?php _e("By Post Status", 'bulk-delete'); ?&...


6

Inside admin-header.php, there's the following set of hooks: do_action('admin_enqueue_scripts', $hook_suffix); do_action("admin_print_styles-$hook_suffix"); do_action('admin_print_styles'); do_action("admin_print_scripts-$hook_suffix"); do_action('admin_print_scripts'); do_action("admin_head-$hook_suffix"); do_action('admin_head'); The one to always use it ...


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