Forums

[Plugin: Greg's High Performance SEO] Plugin breaks AJAXed WordPress. Fix included. (2 posts)

  1. Aaron Harun
    Member
    Posted 1 year ago #

    On line 562 of the main file you have

    if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); // annoyingly, run a loop here to get what we need; this is why we don't bother with extracting keywords for a static posts page
    		if ($this->opt('enable_keywords_custom'))
    			$taglist = $this->get_meta_clean($post->ID,'keywords', true);
    		if ($this->opt('enable_keywords_tags'))
    			$posttags = get_the_tags();

    This is a very hackish way to do it and it breaks any plugin that adds anything before the loop. A better way to do this since all you need to do is grab the id of the single post that is loaded is:

    if (is_single() || is_page() ) {
    global $wp_query; $post = $wp_query->post;
    		if ($this->opt('enable_keywords_custom'))
    			$taglist = $this->get_meta_clean($post->ID,'keywords', true);
    		if ($this->opt('enable_keywords_tags'))
    			$posttags = get_the_tags($post->id);

    A bit further down I also replaced the following to match the brackets above. (On a side not, the code is really not easy to read at all: proper indenting and consistency would help.)

    elseif(is_archive())
    			$taglist = $defaults;
    			endif;

    with

    }elseif(is_archive()){
    			$taglist = $defaults;
    		}

    http://wordpress.org/extend/plugins/gregs-high-performance-seo/

  2. GregMulhauser
    Member
    Posted 1 year ago #

    Many thanks, Aaron, for noticing that we no longer need that instance of the loop there -- just uploaded an update.

    All the best,
    Greg

Topic Closed

This topic has been closed to new replies.

About this Topic