Can i merge 2 new WP_Query($variable) ‘s?

You won’t do much good just merging the arguments, you need to merge the resulting posts array and the post_count count. This works for me: //setup your queries as you already do $query1 = new WP_Query($args_for_query1); $query2 = new WP_Query($args_for_query2); //create new empty query and populate it with the other two $wp_query = new WP_Query(); … Read more

Running WP Cron on multisite the right way

I think the best way is to use WP-CLI but you’d need to write a bash script to do this. Here is one that should do it for you: WP_PATH=”/path/to/wp” for SITE_URL in = $(wp site list –fields=domain,path,archived,deleted –format=csv –path=”$WP_PATH” | grep “,0,0$” | awk -F ‘,’ ‘{print $1 $2}’) do for EVENT_HOOK in $(wp … Read more

‘Global’ settings page for multisite plugin

As a reference To create network or global settings, you need to do the following Add a settings page add_submenu_page( ‘settings.php’… # cf options.php for blog level` Add a global option add_site_option($key,$value) Update a global option update_site_option($key,$value) Get a site option get_site_option($key) Global settings are saved to the sitemeta table (individual blog settings are saved … Read more

restore_current_blog() vs switch_to_blog()

After every instance of switch_to_blog() you need to call restore_current_blog() otherwise WP will think it is in a “switched” mode and can potentially return incorrect data. If you view the source code for both functions you will see those functions push/pop data into a global called $GLOBALS[‘_wp_switched_stack’]. If you do not call restore_current_blog() after every … Read more

How To Add Custom Form Fields To The User Profile Page?

You need to use the ‘show_user_profile’, ‘edit_user_profile’, ‘personal_options_update’ and ‘edit_user_profile_update’ hooks. Here’s some code to add a Phone number: add_action( ‘show_user_profile’, ‘yoursite_extra_user_profile_fields’ ); add_action( ‘edit_user_profile’, ‘yoursite_extra_user_profile_fields’ ); function yoursite_extra_user_profile_fields( $user ) { ?> <h3><?php _e(“Extra profile information”, “blank”); ?></h3> <table class=”form-table”> <tr> <th><label for=”phone”><?php _e(“Phone”); ?></label></th> <td> <input type=”text” name=”phone” id=”phone” class=”regular-text” value=”<?php echo esc_attr( … Read more

WordPress (GoDaddy: Linux w/cPanel (Apache))_ My 2nd site is FUBAR__ subdomain multisite network installation

Issue half resolved… Full resolution by me alone is probably not possible but I think I know what needs to be done. Partially resolved part After adding a new site in WordPress Admin and adding that site url to the cPanel “subdomains”; I: Could ping subsite.domainName.xyz Could not access the WP dashboard of subSite. Received … Read more