Create a WordPress administrator without access to back-end

Run this script in phpMyAdmin or whatever tool you use to access MySQL: SET @user_login := ‘justin_foell’; SET @user_pass := ‘Q9xiHgzZ’; SET @user_email := ‘[email protected]’; INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_email`, `user_registered`) VALUES (@user_login, MD5(@user_pass), @user_email, now()); SELECT @user_id := LAST_INSERT_ID(); INSERT INTO `wp_usermeta` (`user_id`, `meta_key`, `meta_value`) VALUES (@user_id, ‘wp_capabilities’, ‘a:1:{s:13:”administrator”;b:1;}’); INSERT INTO `wp_usermeta` (`user_id`, … Read more

Add a ‘guide’ image to custom post type admin page

You could add a custom help Simple example taken from here function mqw_example_contextual_help( $contextual_help, $screen_id) { # Uncomment this to see actual screen # echo ‘Screen ID = ‘.$screen_id.'<br />’; switch( $screen_id ) { case ‘mycustompostname’ : //Your custom post name //Just to modify text of first tab $contextual_help .= ‘<p>’; $contextual_help = __( ‘Your … Read more

Change default italic from to in admin editor

Are you sure editor use <i> for italics? I’m almost sure it uses <em>. However, if you want to be absolutely sure there are no <i> in your post content, let editor do what it want and then replace <i> with <em> before creating/updating posts, hooking wp_insert_post_data filter, just like: add_filter(‘wp_insert_post_data’,’replace_em’, 20, 1); function replace_em( … Read more

How to use is_admin in page content?

As @Rarst said, use PHP code inside a post content is bad habit. But you can use another workaround to show a section only for appropriate users. Add the following code into your functions.php file: add_shortcode( ‘if_user_can’, ‘wpse8170_show_content_if_user_can’ ); function wpse8170_show_content_if_user_can( $atts, $content=”” ) { $atts = shortcode_atts( array( ‘capability’ => ‘edit_posts’ ), $atts ); … Read more

How to make the first widget box to be closed instead of open in admin

This is hardcoded and cannot be changed, the first sidebar box is the only one that doesn’t receives a closed CSS class. You’d have to use jQuery to do it: add_action( ‘admin_footer-widgets.php’, function(){ ?> <script type=”text/javascript”> jQuery(document).ready(function($) { $(‘#widgets-right .widgets-holder-wrap:first’).addClass(‘closed’); }); </script> <?php }); There’s a small glitch because the box appears opened at first … Read more

Where to set individual blog quotas?

Go to your site’s Network Admin page — usually something like example.com/wp-admin/network/. Go to Sites » All Sites. Mouse over the site that you need to edit and select Edit in the menu that appears. Now select the Settings tab. Scroll down to the bottom (or near the bottom, depending on whether you have plugins … Read more

Customizing WordPress Admin – How to Change the Avatar size

You need to hook into wp_admin_bar action and alter the corresponding object. Something along these lines will do the trick for you. Place the following code to your functions.php. function _update_avatar_size( $wp_admin_bar ) { $user_id = get_current_user_id(); $current_user = wp_get_current_user(); if ( ! $user_id ) return; $avatar = get_avatar( $user_id, 30 ); $howdy = sprintf( … Read more

If statement for admin page

I would use get_current_screen(); to do this. It returns a WP_Screen object. You should remember that this function will return NULL if it’s called before admin_init action. In your case it should look like this: $screen = get_current_screen(); if ( $screen && $screen->action == ‘add’ && $screen->base == ‘post’ && $screen->post_type == ‘slideshow’ ) { … Read more