Display site administrator’s id by current blog id inside link

If you want to construct for example: http://example.com/?ref=1,8,22 for multiple administrators of the current sub site, you can try the following (untested): $uids = get_users( array( ‘blog_id’ => get_current_blog_id(), ‘role’ => ‘administrator’, ‘fields’ => ‘ID’, ‘order_by’ => ‘ID’, ‘order’ => ‘ASC’, ) ); echo $url = add_query_arg( array( ‘ref’ => join( ‘,’, $uids ) ), … Read more

Admin doesn’t have sufficient permissions to plugin’s page

According to the documentation for add_menu_page: Note: If you’re running into the “You do not have sufficient permissions to access this page” error, then you’ve hooked too early. The hook you should use is admin_menu. This means you need to wrap your menu creation in something like: add_action( ‘admin_menu’, function() { add_menu_page( // page title … Read more

Manage users custom column add class “num”

The solution is simple. Add the word num when defining the column like this: // Add users table header columns add_filter( ‘manage_users_columns’, ‘gtp_users_table_columns’ ); function gtp_users_table_columns( $defaults ) { $defaults[‘purchased-leads num’] = __( ‘Purchased leads’, ‘gtp_translate’ ); return $defaults; } // Add users table lead purchase column content add_action( ‘manage_users_custom_column’, ‘gtp_users_table_content’, 10, 3 ); function … Read more

Admin Options page. Save as Array

You only need to register one setting and then just modify your form inputs to save the values into an array. Here’s an example of registering the setting: register_setting( ‘mytheme_settings’, ‘mytheme_settings’, ‘admin_options_sanitize’ ); $mytheme_settings = get_option( ‘mytheme_settings’ ); and the field markup: <textarea name=”mytheme_settingsAdmin Options page. Save as Array”> <?php echo esc_textarea( $mytheme_settings[‘title’] ); ?> … Read more

Change default Posts page

This was answered in a previous question: https://stackoverflow.com/questions/31434373/in-wordpress-how-do-i-set-the-default-admin-sort-order-for-a-custom-post-type-t#answer-31520570 This accepted answer will walk you through how to set up the pre_get_posts callback. That would be my recommendation.

WordPress not working on localhost

1) Make sure the wp-config.php doesn’t have multisite reference settings such as define(“DOMAIN_CURRENT_SITE”, “somesite.com” );. If it does, delete these settings 2) If you have updated siteurl and home settings in the *_options table to use local settings and it still doesn’t work, then 3) Delete all themes but a basic one (twentytwelve, twentythirteen,…) and … Read more