Plugin Directory

Changeset 1864542


Ignore:
Timestamp:
04/26/2018 05:18:50 AM (8 years ago)
Author:
nitinvp
Message:
  • Corrected cleaning up of post data after search result traversal. This fixes the issue of displaying Variables prev/next links in blog posts when a Variable is used and also disrupting other plugins like social sharing.
  • Corrected Variable specific updates messages.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • c9-variables/trunk/includes/code/basic/public/core/class-c9-variables-public-delegate.php

    r1863910 r1864542  
    2727            $name = C9_Text_Utils::html_entity_decode($attribs[C9_Variables_Constants::$NAME_ATTRIB], C9_Variables_Constants::$VARIABLE_NAME_SANITIZE_PATTERN);
    2828            $results = new WP_Query([C9_Variables_Constants::$POST_TYPE_FIELD => C9_Variables_Constants::$VARIABLES_POST_TYPE, 'name' => $name, 'posts_per_page' => 1]);
    29             while($results->have_posts()) {
     29            if($results->have_posts()) {
    3030                $results->the_post();
    3131                $var = get_the_content();
    3232                $var = do_shortcode($var);
    3333            }
     34           
     35            // Clean up
     36            wp_reset_postdata();
    3437        }
    3538        if (C9_Logger::is_debug_enabled()) {
    3639            C9_Logger::debug(sprintf("C9_Variables_Public_Delegate::get_variable(): name: '%s', content: %s", $name, $var));
    3740        }
     41       
    3842        return $var;
    3943    }
Note: See TracChangeset for help on using the changeset viewer.