Skip to content

Instantly share code, notes, and snippets.

@davidsword
Last active June 4, 2018 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidsword/0245388543b614e3d21ec6f9f0716595 to your computer and use it in GitHub Desktop.
Save davidsword/0245388543b614e3d21ec6f9f0716595 to your computer and use it in GitHub Desktop.
Wordpress - do tax_query with switch_to_blog() work-around
<?php
global $wp_taxonomies;
switch_to_blog($new);
if(!taxonomy_exists('my_missing_tax'))
$wp_taxonomies['my_missing_tax'] = 'delete';
// do `tax_query`'s in $new with `my_missing_tax`
if ($wp_taxonomies['my_missing_tax'] == 'delete')
unset($wp_taxonomies['my_missing_tax']);
switch_to_blog($current);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment