Last active
June 4, 2018 21:50
-
-
Save davidsword/0245388543b614e3d21ec6f9f0716595 to your computer and use it in GitHub Desktop.
Wordpress - do tax_query with switch_to_blog() work-around
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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