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.

Please consider registering
guest

Log In

Lost password?
Advanced Search:

— Forum Scope —



— Match —



— Forum Options —




Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
Fix for unchanged title with gzip enabled
August 28, 2010
8:49 am
SanderK
New Member
Forum Posts: 1
Member Since:
August 28, 2010
Offline

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

Forum Timezone: America/New_York

Most Users Ever Online: 205

Currently Online:
36 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

romiojuliat: 102

yaoming987: 50

jintuy: 50

miki1986: 33

newshow: 28

karen1234: 27

Member Stats:

Guest Posters: 0

Members: 6356

Moderators: 3

Admins: 4

Forum Stats:

Groups: 5

Forums: 23

Topics: 1546

Posts: 3450

Newest Members: carofern@cisco.com, pronto, jessie, pbaylies, ninaeast, freda

Moderators: davecashmore (2), aaron (5), tempadmin (0)

Administrators: WordPress Professional (442), hallsofmontezuma (202), onefinejay (10), stevemortiboy (4)