[wp-trac] [WordPress Trac] #16642: Function "remove_filter" does not seem to work right
WordPress Trac
wp-trac at lists.automattic.com
Fri Feb 25 00:41:14 UTC 2011
#16642: Function "remove_filter" does not seem to work right
--------------------------+------------------------------
Reporter: 1manfactory | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Formatting | Version: 3.1
Severity: normal | Resolution:
Keywords: |
--------------------------+------------------------------
Comment (by sivel):
I haven't tried any of the plugins referenced to have issues but did
create a test plugin that successfully removes that filter and adds a new
filter without issue.
When I get a chance I will try to test. however, looking at what those 2
plugins do, leads me to believe it was likely the addition of the
following code in sanitize_title and has nothing to do with the filter
referenced:
{{{
if ( 'save' == $context )
$title = remove_accents($title);
}}}
A work around may be to do something like:
{{{
remove_filter( 'sanitize_title', 'sanitize_title_with_dashes');
add_filter( 'sanitize_title', 'restore_raw_title', 9, 3 );
function restore_raw_title( $title, $raw_title, $context ) {
if ( $context == 'save' )
return $raw_title;
else
return $title;
}
}}}
And then go about adding your own filter at priority 10 or higher to
filter sanitize_title the way you want.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16642#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list