WordPress 3.8 get current admin color scheme

I actually made it! In my script file, at the to I define a new variable and copy the $_wp_admin_css_colors variable into it using the admin_head hook, since the variable gets destroyed at some later point: <?php global $admin_colors; // only needed if colors must be available in classes add_action(‘admin_head’, function() { global $_wp_admin_css_colors; global … Read more

Overview with latest edited posts and pages

You can use the $WPDB query to query the DB, an example would be: $editedposts = $wpdb->get_results( ” SELECT ID, post_title FROM $wpdb->posts WHERE post_modified = between DateAdd(DD,-7,GETDATE() ) and GETDATE() ” ); This lists all posts which have been edited in the last 7 days (not tested), you would do something similar to get … Read more

How to Change the Title of a Meta Box on a Specified Custom Post Type? [duplicate]

Yes – you need a slightly modified version of this answer. add_action( ‘add_meta_boxes_post’, ‘wpse39446_add_meta_boxes’ ); function wpse39446_add_meta_boxes( $post ) { if( ‘mycpt’ == get_post_type($post) ){ remove_meta_box( ‘authordiv’, ‘mycpt’, ‘core’ ); add_meta_box( ‘authordiv’, __(‘Team Member’,’wpse39446_domain’), ‘post_author_meta_box’, ‘mycpt’, ‘advanced’, ‘high’ ); } } Note: If you are doing this for a non-core metabox, you’ll need to ensure … Read more

Wrong url in sortable column headers & pagination in the admin, when behind a proxy

Ok so apparently this site is behind a firewall or proxy. On lines 491 and 658 in wp-admin/includes/class-wp-list-table.php, replace this line $current_url = ( is_ssl() ? ‘https://’ : ‘http://’ ) . $_SERVER[‘HTTP_HOST’] . $_SERVER[‘REQUEST_URI’]; with if(!empty($_SERVER[‘HTTP_X_FORWARDED_HOST’])){ $hostname = $_SERVER[‘HTTP_X_FORWARDED_HOST’]; } else { $hostname = $_SERVER[‘HTTP_HOST’]; } $current_url = ( is_ssl() ? ‘https://’ : ‘http://’ ) … Read more

Make “Post published. View post” Open in a New Tab

Open WP-Admin Editing File: Open the file located at: /example.com/public_html/wp-admin/edit-form-advanced.php Edit: Edit these lines to look like the next, adding target=”_blank” to each link or pasting the whole list. $messages = array(); $messages[‘post’] = array( 0 => ”, // Unused. Messages start at index 1. 1 => sprintf( __(‘Post updated. <a href=”https://wordpress.stackexchange.com/questions/173819/%s”>View post</a>’), esc_url( get_permalink($post_ID) … Read more

How to Remove the “Restore” Link in Quick Edit?

This will do: add_filter(‘post_row_actions’, ‘wpse_56560_remove_untrash’, 10, 2); add_filter(‘page_row_actions’, ‘wpse_56560_remove_untrash’, 10, 2); function wpse_56560_remove_untrash( $actions, $post ) { if( !isset( $actions[‘untrash’] ) ) return $actions; // If NOT administrator, remove Untrash if( !current_user_can(‘administrator’) ) unset( $actions[‘untrash’] ); return $actions; }

Hide pages depending on role

To get the current role of the user $current_user = wp_get_current_user(); if ( !($current_user instanceof WP_User) ) return; $roles = $current_user->roles; //$roles is an array After getting role set page ids which you want to show according to roles (for example) if($roles==’administrator’){ $args=array(’21’,’22’,’23’); } or if($roles==’subscriber’){ $args=array(’24’,’25’,’26’); } you can use parse_query filter hook to … Read more