Domanda

La mia query personalizzata funziona, ma in modalità di debug ricevo questo errore:

Notice: Undefined offset: 0 in /storage/content/24/150624/mydomain.com/public_html/wp/mysite/wp-includes/query.php on line 2232 

Ecco come appare la mia domanda:

<?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>

<?php 
global $post;

$args = array(
'tax_query' => array(
array(
    'taxonomy' => 'machinecategory',
    'terms' => $term,
    'field' => 'slug',
    'operator' => 'IN'
)
),
'posts_per_page' => -1,
'post_type' => 'machine',
);

$my_query = new WP_Query($args); ?>
<?php if ($my_query->have_posts()) : ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<?php the_title();?> 
<?php endwhile; ?>
<?php endif;?>

<?php wp_reset_query(); ?>

Cosa potrebbe essere sbagliato?

Nessuna soluzione corretta

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a wordpress.stackexchange
scroll top