WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using a widget, U more recent posts. Seems to work with custom taxonomies when you input the correct data into it in a widget form, but the suggested shortcode doesn't work (and I am trying to insert it into a post).

He suggests including the following;


so I have tried....

[u_more_recent_posts id="hue-recent-posts" tax_query="taxonomy=destinations&terms=174" post_type="post"]

I am sure, I just need to alter the shortcode slightly for it to work, but have been trying for hours and can't work it out!! Any help would be ENORMOUSLY appreciated!!

I think the relevant code in the plugin are;

if( !empty($opts['post_type']) ) {
    $query_args['post_type'] = $opts['post_type'];

    if( !empty($opts['tax_query']) AND isset($opts['tax_query'][$opts['post_type']]) ) {
        $tax_query = $opts['tax_query'][$opts['post_type']];

        if( !empty($tax_query['taxonomy']) AND !empty($tax_query['terms']) ){
            $tax_query['terms'] = explode(',', preg_replace('/\s*/', '', $tax_query['terms']));
            $_tax_query = array(
                'taxonomy' => $tax_query['taxonomy'],
                'terms' => $tax_query['terms'],
                'field' => 'id',
            $operator = '';
                case 'include': $operator = 'IN'; break;
                case 'exclude': $operator = 'NOT IN'; break;
                case 'and': $operator = 'AND'; break;
            if( !empty($operator) )
                $_tax_query['operator'] = $operator;

            $query_args['tax_query'] = array($_tax_query);

and this bit.....

if( isset($atts['tax_query']) ){
    $opts['tax_query'] = array($opts['post_type'] => wp_parse_args(preg_replace('/&/', '&', $atts['tax_query'])));

Thanks very much in advance, I am completely stuck!!

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.