Support

Account

Home Forums Front-end Issues Filter repeater fail

Solved

Filter repeater fail

  • I don´t know what wrong:

     function my_tematica_where( $where ) {
        $where = str_replace("meta_key = 'temas_%", "meta_key LIKE 'temas_%", $where);
        return $where;
        }
    
    add_filter('tematica_where', 'my_tematica_where');
    
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
        $noticias = new WP_Query(
        array(
            'post_type' => 'noticias',
            'posts_per_page' => 16,
            'orderby' => 'asc',
            'paged' => get_query_var('paged'),
            'post_status' => 'publish',
            'meta_query' => array(
              'relation'    => 'OR',
                array(
                    'key' => 'id_tg',
                    'value' => $elvalue,
                    'compare' => 'like'
                ),
                array(
                    'key' => 'temas_%_tema_general',
                    'value' => $postidtema,
                    'compare' => '='
                )
            )
        
        )
    ); 
    
      }

    Any clue?

  • Hi @leyzaola

    I believe there’s no tematica_where hook set on your site. You need to use the post_where hook instead. To learn more about post_where hook, please take a look at this page: https://codex.wordpress.org/Plugin_API/Filter_Reference/posts_where.

    I hope this helps 🙂

  • Working, thank you James!

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Filter repeater fail’ is closed to new replies.