WordPress.org

Ready to get started?Download WordPress

Forums

wp_get_object_terms returning an empty array (1 post)

  1. moikirsch
    Member
    Posted 1 year ago #

    I have the following code:

    $objects = get_posts( array( 'post_type' => 'negocio', 'zona' => get_query_var( 'zona' ), 'posts_per_page' => -1, ) );
    $objects_ids = wp_list_pluck( $objects, 'ID' );
    $categorias = wp_get_object_terms( $objects_ids, 'categoria' );

    I'm sure that $objects_ids has at least one ID and the taxonomy 'categoria' exisist and it should have at least on taxonomy. (every object hast at least on taxonomy of type zona and one taxonomy of type categoria).

    The problem is that I'm getting an empty array. I'm not sure if the problem is actually related to this piece of code or maybe to a plugin or something else.

    How can I debug this? I usually use a bunch of $print_r to check the results on everything but in this case I think that I need to go deeper to find out the issue.

    Any ideas or comments are welcome.

Topic Closed

This topic has been closed to new replies.

About this Topic