Fix for unchanged title with gzip enabled Optimizing All in One SEO Pack Forum

The support forums have a new home! Please visit All in One SEO Pack's new residence at Semper Plugins to purchase a support plan.

 
You must be logged in to post
Search Forums:


 






Minimum search word length is 4 characters – Maximum search word length is 84 characters
Wildcard Usage:
*  matches any number of characters    %  matches exactly one character

Fix for unchanged title with gzip enabled

Post
New Member

SanderK

posts 1

8:49 am August 28, 2010

Post edited 8:50 am – August 28, 2010 by SanderK


Hello,

There seems to be a certain bug in the SEO pack where the title of a page/post/etc would not update when GZIP is enabled. After some hours of debugging I found a fix; perhaps I can help someone else out with posting the fix here.

In aioseop.class.php, find the function replace_title. Replace it with the following;

function replace_title($content, $title) {

$clean_content = $this->gzdecode($content);
$len_start = strlen('<title>');
$len_end = strlen('</title>');
$start = strpos($clean_content, '<title>');
$end = strpos($clean_content, '</title>');
$this->title_start = $start;
$this->title_end = $end;
$this->orig_title = $title;

if($start && $end) {
$clean_content = substr($clean_content, 0, $start + $len_start) . $title . substr($clean_content, $end);
}

return gzencode($clean_content);
}

You'll also need the gzdecode function, which can be found on the following page;

http://php.net/manual/en/funct…..decode.php

Look in the comments. Add this function to the class.

I can't guarantee this will work on any site, but it works on mine so I'm happy.

Cheers,

Sander


About the WordPress Developer Forum

Forum Timezone: America/New_York

Most Users Ever Online: 205

Currently Online:
28 Guests

Currently Browsing this Topic:
1 Guest

Forum Stats:

Groups: 5
Forums: 23
Topics: 1543
Posts: 3447

Membership:

There are 6357 Members

There are 4 Admins
There are 3 Moderators