0

Referencing this question:

How to add/save Custom Field in user settings/profile "Checkbox list"

I've been trying to get this working, but am having a few issues. I'm using the following line to query the database:

$tags = get_the_author_meta( 'user_interests', $user_ID );
<?php $query = new WP_Query( array( 'tag__in' => array( $tags) ) ); ?>

and the query returns blank. If I print_r the $tags I get

Array ( [74] => 74 )

and if I replace the $tags with 74 directly I get the current content returned. I'm missing something simple, aren't I? Could anyone point me in the right direction?

thanks!

0

1 Answer 1

0

Got it - just use this:

<?php $query = new WP_Query( array( 'tag__in' => $tags ) ); ?>
1
  • Just to clarify for others - $tags was already an array in the correct format for the tags__in parameter. Wrapping it in another array "nested" it too deep and WP_Query was unable to understand the argument. Commented Aug 13, 2015 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.