There are actually two problems:
-
The
&
is encoded as&
, so you have to usehtml_entity_decode()
first. -
Multi-byte characters need more than one byte, and
strlen()
will fail with them. Don’t use strlen().
So use something like this:
$title = html_entity_decode( get_the_title(), ENT_XML1, 'UTF-8' );
$length = mb_strlen( $title, 'utf-8' );
Related Posts:
- Filter the blog title displayed in the header
- Blank on static home page?
- “Maximum function nesting level of ‘100’ reached” after adding a new filter
- String replace WordPress Site Title
- Customized title tag for each page in pagination?
- Browser title script ignoring is_page /else conditional [closed]
- Blank space at beginning of tag?
- Filter get_the_title to remove certain characters?
- get_page_by_title with an apostrophe in variable
- Locating Global Variables
- Set post title based on first h2 element in the content section
- An extra ‘ is displayed in the title
- Part of title duplicating but not sure how to remove from code – help?
- Applying A Category to Existing Posts Where Page Title Matches Regex
- Remove the first 5 characters of the_title and orderby that
- Change title only in dynamic page
- Display custom post type title as text if post thumbnail is not available
- Change page title from page using php via php executed from page/post itself
- Reduce size of responsive title
- Run str_replace on title and save the output to a custom field
- Echo title attribute php
- change title page on search result
- woocommerce related product title length
- Split site title and apply different classes
- Insert content into head tag with function
- How do I choose not to display the title header on a specific page?
- Set document title through shortcode plugin
- how to replace h1 entry title with h2 in category pages only
- Posts title instead of Pages and Category titles – PHP WordPress
- Time Stamp In A WordPress Post Title That Does Not Keep Refreshing
- How can I get the custom post title?
- Site title not showing. Please help me
- How to display custom seo title before the loop?
- Put a span class in the shortened product title
- Allowing HTML elements in title widgets spacing problem
- “Page Array” displaying in title bar on Front Page
- Replace Underscore (_) on Space ( )
- my site show this symbol (::) between site title and tagline
- Display tab title as ‘blog tagline | blog title’
- Custom field in title
- Hide page title
- Getting a specific “title for a section” only on Startpage?
- Split titles by the ” – ” in WordPress
- Is it possible to remove the “Shop” title from the WooCommerce catalogue? [closed]
- Error while setting role
- How can I remove the first two words and shorten get_the_title()
- Editing a PHP file to include a small text piece on every page
- Get categories names as an array to use it in theme settings
- Should i use the wordpress Options table or to create database table..?
- variable value disappears in a second loop
- Force Users To Relogin
- unknown issue in ‘header.php’ preventing theme from displaying fully
- Hide a div to subscribers(user role) in one page (is_page)
- Security updates to 3.3.2
- Where is this function’s callback getting its arguments from?
- How can I use a sliced image As banner? [closed]
- persist a variable set in header.php all the way down to footer.php
- Can a page contain php code?
- Last class on last headline?
- Unable to Find Space in Custom Function
- Is it possible to display a DIV to not logged in users and then change it for users who are logged in?
- Strip Paragraph Tag
- Unable to process php via shortcode
- working with term_relationships table
- Creating a blog on my companies new website using WordPress but I have sidebar issues
- Creating a mobile site by adding a new class to the body tag from functions.php
- WordPress plug-in for dynamic download link?
- Using WP functions such as the_title() in an included php file
- GET problem in WordPress
- WordPress gallery shortag
- Almost Done… Post Format Code
- wordpress admin plugin menu custom css
- Help with page nav?
- Show recent posts starting at a specific number archive
- Add title=”” to A PHP Code
- Get Page ID from Backend
- Help with WordPress function inside a shortcode
- Wpdb->insert() doesn’t insert new row after the last one
- WordPress plugin admin page – using WordPress function in linked php file
- HTML table attributes ignored
- What’s the best way to include PHP code in pages?
- Is there any wordpress plugin to upload images and captions to multiple pages once
- How to fix this PHP warning in WP-Admin after upgrading to 3.1.2?
- PHP in Edit Post link
- Removing the first 8-10 letters from a post?
- How to add drag and drop functionalities to a div inside option panel
- WordPress and MySQL: trying to print data using PHP from user_meta custom field data
- Timthumb.php image gallery not working on Multisite WordPress
- Function Reference Documenting Template Tags for use in Custom Theme Templates?
- How do you create two separate Register pages?
- $_GET[‘updated’] does not work in WordPress 3.1?
- Why doesn’t PhotoSmash plugin play well with wp_query?
- How to send form data from WordPress (Meta Box) to an OData service?
- How to Configure Events List in WordPress to Disappear Event Once Date is Past
- Removing WordPress Footer -without access to PHP code?
- dynamic page using php from sql database
- Upload non-featured image to image field
- Usage of call back function of add_meta_box()
- Building a REST API for your web app exposes primary keys of DB records?
- WordPress get_media_embedded