WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created a custom loop using WP_Query for my featured content slider.

$slider_query = new WP_Query();
$slider_query->query("posts_per_page=5&tag=".(get_option('cgr_slider_tag'))" ");?>
<?php while ($slider_query->have_posts()) : $slider_query->the_post(); ?>

    <article class="slide-item ">


It works fine in previous 3.1.4 , but after upgraded to 3.2 that code is just didn't work. No error found in WP_Debug mode, and Then i try to directly assign the tag name without using the get_option :

$slider_query = new WP_Query();
<?php while ($slider_query->have_posts()) : $slider_query->the_post(); ?>

 <article class="slide-item ">


it works, so i assume the problem is the get_option thing. I've checked the database and other part of the theme that also using get_option and found no problem.

I start thinking that the problem is I didn't code the get_option part correctly, i'm php noob so maybe it's about encapsed string or others.

Any help will be appreciated.

share|improve this question
up vote 2 down vote accepted

this line:

$slider_query->query("posts_per_page=5&tag=".(get_option('cgr_slider_tag'))" ");

should be:

share|improve this answer
Thanks. it works. I should learn more about writing a good php code. – Faizal Al-Amri Jul 10 '11 at 0:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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