I have installed wodpress on the top of wordpress many occasions, through SVN and changing folders... The database continued to be always exactly the same. All of a sudden a brand new copy from SVN can't operate in two different machines using the following code, from wordpress survey and quiz tool:

function wpsqt_main_site_quiz_page($atts) {

    extract( shortcode_atts( array(
                    'name' => false
    ), $atts) );

    if ( !$name ){
        require_once WPSQT_DIR.'/pages/general/error.php';

    require_once WPSQT_DIR.'/includes/site/quiz.php';
    $content = ob_get_contents();
    return $content;

add_shortcode( 'wpsqt_page' , 'wpsqt_main_site_quiz_page' );// Deprecated and will be removed
add_shortcode( 'wpsqt_quiz' , 'wpsqt_main_site_quiz_page' );

Basically use echo to determine in which the code has been arrived at, add_shotcode has been arrived at while within the function isn't and also the page just shows this:

[wpsqt_quiz name="test"]

Rather than changing it using the expected quiz.php.

Now I simply erased the database got a brand new install of wordpress and also the wordpress plugin, not to mention everything labored fine. Basically obtain the SVN version, which is not everything modified (it simply got 1 wordpress plugin - Miracle Fields - along with a personalized theme), take away the wordpress plugin and do the installation again, still it does not work!

What is failing here? What's satisfied to create add_shortcode work?

This problem have been annoying me since yesterday. Finally discovered the main reason, (now) clearly around the personalized template.

The header incorporated a phone call to query_posts, which allegedly are only able to be known as once per page load. Then there comes wp_reset_query to rescue. But wait! Appears like each of individuals functions are deprecated nor ought to be used! Rather, we ought to always employ WP_query object.

So, this works but it is wrong:

<?php query_posts('showposts=10'); ?>  
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>  
   <li><a href="<?php the_permalink() ?>"><?php the_title() ?></a></li>  
<?php endwhile; endif; ?>  
<?php wp_reset_query(); ?>  

and this is actually the right and most convenient way:

<?php $r = new WP_Query(array('showposts' => '10', 'what_to_show' => 'posts', 'nopaging' => 0, 'post_status' => 'publish', 'caller_get_posts' => 1)); ?>  
<?php if ($r->have_posts()) : while ($r->have_posts()) : $r->the_post(); ?>  
   <li><a href="<?php the_permalink() ?>"><?php the_title() ?></a></li>    
<?php endwhile; endif; ?> 

Without that, the following query_posts around the page itself aren't correctly loaded and therefore the [wpsqt_quiz name="test"] included (within the page publish) isn't known as.

Also, it appears like [wpsqt_quiz name="test"] can't be included to web site page.

That's all.