Assigning alternate single-{cpt} template based on blog_id in multisite

Actually, I noticed that your closure is not capturing/using the proper $template variable which is passed from the template_include filter hook: // This hook is defined in wp-includes/template-loader.php $template = apply_filters( ‘template_include’, $template ) The closure is also not returning the template.. So your closure should look like: add_filter( ‘template_include’, function( $template ) use ( … Read more

get_user_meta() in multiste with respect to subdomain

You could catch and store the data separately on a per blog basis by filtering the user meta update call, via the update_user_metadata filter… function myplugin_init() { add_filter( ‘update_user_metadata’, ‘myplugin_update_points’, 10, 5 ); } function myplugin_update_points( $null, $object_id, $meta_key, $meta_value, $prev_value ) { if ($meta_key == ‘qa_point’) { remove_filter( ‘update_user_metadata’, ‘myplugin_update_points’, 10, 5 ); global … Read more

403 forbidden when changing settings on WP Multisite non-main sites

I had the same problem – I found the rules in Apache modsecurity that include a set of exclusions for WordPress didn’t cover /network/site-settings.php, so I could do everything except edit sites in my multisite setup. In the file /usr/share/modsecurity-crs/rules/REQUEST-903.9002-WORDPRESS-EXCLUSION-RULES.conf I added the following lines: SecRule REQUEST_FILENAME “@endsWith /wp-admin/network/site-settings.php” \ “id:9009999,\ phase:1,\ pass,\ t:none,\ nolog,\ … Read more