Set Featured Image programmatically (in admin) with JavaScript?

You need to do an ajax call with action: ‘set-post-thumbnail’ Check in admin-ajax.php (line 1477 in 3.3.2) for the expected values and nonce, but in general you need to send post_id, attachment_id and nonce. The nonce should come from: wp_create_nonce( “set_post_thumbnail-$post_id” ); The admin does something like: uploader.bind(‘FileUploaded’, function(up, file, response) { jQuery.post(ajaxurl, { action:”set-post-thumbnail”, … Read more

Cannot login to WordPress Admin with SSL terminated load balancer

I just figured out the issue. You need to add the HTTPS/SSL settings before require_once(ABSPATH . ‘wp-settings.php’); in your wp-config.php So the relevant part of your wp-config.php should look like this. define( ‘FORCE_SSL_ADMIN’, true ); // in some setups HTTP_X_FORWARDED_PROTO might contain // a comma-separated list e.g. http,https // so check for https existence if( … Read more

Is it OK to move admin menu items?

this might work: add_filter(‘custom_menu_order’, ‘my_custom_menu_order’); add_filter(‘menu_order’, ‘my_custom_menu_order’); function my_custom_menu_order($menu_ord) { if (!$menu_ord) return true; return array( ‘index.php’, // the dashboard link ‘edit.php?post_type=custom_post_type’, ‘edit.php?post_type=page’, ‘edit.php’ // posts // add anything else you want, just get the url ); }

WordPress Admin back-end – advanced options page?

// Adds ‘ALL’ options page – only accessible for admins and custom roles that have the ‘manage_options’ capability. function wpse31956_all_settings_page() { add_options_page( __(‘All’), __(‘All’), ‘manage_options’, ‘options.php’ ); } add_action( ‘admin_menu’, ‘wpse31956_all_settings_page’ ); Note: As I just saw that me an @ChipBennet posted at nearly the same time: The answer is the same.

Read only capability for custom post in admin area

brasolfilo’s suggestion that you remove the submit meta box is only part of what I’d consider a complete solution. I can hack a “submit” button into that page using FireBug or any of a few other tools, in a matter of minutes. I would… Remove the meta box. This is brasofilo’s solution, and I won’t … Read more

Get current active wp color scheme

The current admin color scheme is a user setting, you can get its value with: $current_color = get_user_option( ‘admin_color’ ); See the function admin_color_scheme_picker() in wp-admin/includes/misc.php for an usage example.

How to Make an admin_notices Message That Disappears Once the User Leaves That Particular Page?

The short answer is: Use Query Strings. If you notice in the address bar immediately after you publish a Post… You will see something similar to this: domain.com/wp-admin/post.php?post=4935&action=edit&message=6 There’s a few different Query Variables: post contains the ID of the Post being edited. action is saying we’re currently “editing” the Post. message refers to what … Read more

How to add custom columns to Custom Post Type admin screen

The code from ThinkVitamin is right. I think the problem came from else where in your code. Actually, the hook manage_edit-${post_type}_columns takes an argument $columns which is an array of all registered columns. To add a new column, just add a new element to this array, like this: add_filter(‘manage_edit-film_columns’, ‘my_columns’); function my_columns($columns) { $columns[‘views’] = … Read more