0

They help me as is the right way to do this.

$query = new WP_Query( array(
    'post_type' => 'spa',
    'name' => 'echo sanitize_title(news_get_meta('gamers'));'
) );
0

Except the title of the post is

echo sanitize_title(news_get_meta('gamers'));

I'm assuming news_get_meta is a function particular to a theme or plugin you have installed, so your query should be:

$query = new WP_Query( array(
    'post_type' => 'spa',
    'name'      => sanitize_title( news_get_meta('gamers') );
) );
  • You're welcome, you should tick it as the correct answer and also upvote – Tunji Feb 11 '17 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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