开发者

wordpress stripping out apostrophes in the_title

开发者 https://www.devze.com 2023-03-04 23:29 出处:网络
I\'m running the Wordpress loop and when I display the_title() it is stripping out all apostrophes...

I'm running the Wordpress loop and when I display the_title() it is stripping out all apostrophes...

Something that says Matt's Books is disp开发者_如何学Claying as Matts Books.

I've done some research looking into the formatting.php, post-template.php, and other pages as well as the codex and haven't been able to come across an answer.

Any help would be appreciated.

Edit

The answer to this was to simply comment out around line 103 of wp-includes/default-filters.php:

// Default Filters
// add_filter( 'the_title', 'wptexturize'   ); /*comment out this line */


Hacking WordPress Core is NEVER a good idea.

The wptexturize filter converts characters to their proper HTML entity. If it's not converting apostrophe characters correctly there could be a character encoding setting problem or most likely an issue with the theme your using.

What is your character encoding set to in settings - reading settings?

If you want to remove the wptexturize filter the proper way is to add this to your functions.php

remove_filter ('the_title', 'wptexturize'); 


I suspect it could be issue with the particular theme you're using.

Try putting html code ' in place of apostrophe.

Also take a look at this blog post related to the same problem: http://takethu.com/blog/2006/09/01/wordpress-curlification-of-apostrophe-in-title/


Try to echo the title of the website like this:

<title><?php echo "Someone's Website" ?></title>

It will not escape apostrophe.

0

精彩评论

暂无评论...
验证码 换一张
取 消