Use mb_strlen()
, not strlen()
.
The same with mb_substr()
and substr()
: Your title contains multi-byte characters, but strlen()
and substr()
do not work on characters, they work on single bytes.
For a improved function to shorten strings see this answer.
Related Posts:
- Issues with title-tag and document_title_parts
- How to customize search result page title?
- Breadcrumb how i can display page title with parent > child title with permalink ? any Idea
- Remove H1 / title / Underscore – without CSS
- Is possible add icon in title posts only in specific tag?
- Function extending with if query in functions.php
- Best way to handle lack of titles in microblogging
- add_theme_support( ‘title_tag’ ) is not showing title on index.php
- Echo post title in post
- Change Page Title
- Remove text after a dot and a colon in Woocommerce product title
- Parent category as WOOCommerce Categories widget title
- Display page number on custom page title function
- How to disable site title and description when custom header is uploaded on the customizer?
- Changing the color of post title [closed]
- Force changing the Site Title and add link
- Rename file after title , one small problem
- Remove Actions/Filters added via Anonymous Functions
- Programatically add options to “add new” custom field dropdown
- Excluding iPad from wp_is_mobile
- How to add classes to images based on their categories?
- Use ‘add_theme_support’ instead of ‘add_custom_image_header’ In WordPress 3.4
- Generating Responsive Background Image Sizes in PHP
- Replacing select2 in admin backend for all selects
- How to hook into the quick edit action?
- Override a class function to include a custom template
- How to auto-update child posts whenever the parent post is updated?
- I created a child theme and it doesn’t work for some of the css files
- the_post_thumbnail fallback using hooks
- How to detect first visit of a user?
- Hide WYSIWYG editor on certain templates
- Redirect a list of URLs to another URL, using functions.php
- Override woocommerce wc-class function
- How to hide, and not to remove the attributes metabox?
- how to edit functions.php in a child theme
- Only display link to author social media when it exists [closed]
- Get current page_id before loop, in functions.php
- Menu fallback “menu_class” rendering a “div” instead of a “ul”
- Create single.php for specific tag by tag id or name
- How to automatically remove links from WordPress Biographical Info?
- How to change login labels
- Get the link for RSS item to display in feed
- Shortcode pagination not advancing
- Commenter should see only his comments in wordpress
- translate the_title() with .po & .mo
- Right way to update widget on dynamic new input field
- custom rss templete
- How can i disable auto save & revisions with `function.php` in wordpress?
- Move ‘current-menu-item’ class on #adminmenu li from Posts to Pages for Taxonomy Edit Screen
- Insert image in WordPress with HTML5 tag and caption function
- How to construct function for applying filter?
- WordPress on AWS Auto scaling and ELB giving 503
- is_author(get_current_user_id()) returns false when author id and user id match
- How to use selected WordPress functions?
- Exclude category from shortcode
- unnecessary request call for js and css after calling wp_dequeue_script
- Custom HTML markup
- Functions Error: Impacting Galleries
- How to use author meta in shortcode?
- How to cut off question mark in url with functions.php
- Undefined variable error in new function
- How to rewrite wordpress search to work on specific category
- Theme JS is available but theme CSS isn’t
- Genesis Framework: How to exclude a specific author from archive custom loop
- How to Add Shortcode to html img code?
- Passing Jquery value to WordPress function
- How to pass variables from one function to another or combine functions
- How to create a shortcode out of a php function
- Is it possible to use add_filter in an included file in the child theme’s functions.php?
- Insert Content Before div#main from the functions.php File
- Insert function insde body tag
- Unable to add extra elements to the main navi (wp_nav_menu_items)
- Internet Explorer opens links to .msi files as text in a new tab
- call wp_insert_user in custom class doesnt work
- I would like single.php to act just like index.php
- Does WordPress has an automatic link parse function?
- Conditional custom menu?
- What function actually renders the wp_admin_bar ? How can I call it?
- redirecting a URL if accessed directly
- Detect Ajax call inside pre_get_posts function
- What is wp_get_post_tags for media tags?
- How do I trigger WP CLI DB export using a PHP function?
- WordPress does not load jQuery
- get_current_user_id() always return 0 in if else statement
- Redirect specific author posts to another url
- Show number of sold products but be first for less than 2
- How to retrieve image IDs from shortcode content?
- Class::$template_dir_path=get_template_directory();
- admin-ajax.php & my wp-admin folder url showing in header
- WordPress – Custom Nav menu for logged in users – Shopkeeper theme
- Change post count on tag/terms pages to 10
- How to use if (is_page_template (”))
- Automatically add custom fields (post_meta) to all published posts, hourly, via wp_cron?
- Gravity Forms After Submission – GFFormsModel::update_lead_field_value?
- Fatal error after changes to functions.php, even with original file
- update_post_meta after form is submited
- Should I use `get_stylesheet_uri()` or `get_template_directory_uri()` when calling my CSS Stylesheet?
- Missing argument 2
- WordPress Custom wp mail template return full template
- Comment turned Invisible