Title: [Plugin: Breadcrumb NavXT] Problem with maximum title length
Last modified: August 20, 2016

---

# [Plugin: Breadcrumb NavXT] Problem with maximum title length

 *  multimule
 * (@multimule)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-breadcrumb-navxt-problem-with-maximum-title-length/)
 * Hi, there seems to be a problem with page titles that are exactly the maximum
   title length. In this case, the function title_trim has nothing to trim, but 
   still adds … to the title.
    Suggested bugfix:
 *     ```
       public function title_trim($max_length)
       {
       	$title = $this->title;
       	//Make sure that we are not making it longer with that ellipse
       	if((mb_strlen($this->title) + 3) > $max_length)
       	{
       		//Trim the title
       		$this->title = mb_substr($this->title, 0, $max_length - 1);
       		//Make sure we can split a, four keywords are available %link%, %title%, %htitle%, and %type%pace, but we want to limit to cutting at max an additional 25%
       		if(mb_strpos($this->title, ' ', .75 * $max_length) > 0)
       		{
       			//Don't split mid word
       			while(mb_substr($this->title,-1) != ' ')
       			{
       				$this->title = mb_substr($this->title, 0, -1);
       			}
       		}
       		//Remove the whitespace at the end and add the hellip
       		if ( $this->title != $title ) $this->title = rtrim($this->title) . '&hellip;';
       	}
       }
       ```
   

Viewing 1 replies (of 1 total)

 *  Plugin Author [John Havlik](https://wordpress.org/support/users/mtekk/)
 * (@mtekk)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-breadcrumb-navxt-problem-with-maximum-title-length/#post-2825992)
 * Yeah, the `max_title` length was never an exact cutoff, nothing would ever be
   longer than it, but things could end up being a bit shorter than it. Even if 
   they began under the threshold. I guess we can firm it up a bit. There is probably
   a better way of doing this than what you suggested. It involves checking for 
   strict greater than before the val+3 > max. This check has been implemented in
   the git development branch. See [https://github.com/mtekk/Breadcrumb-NavXT/issues/18](https://github.com/mtekk/Breadcrumb-NavXT/issues/18)

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: Breadcrumb NavXT] Problem with maximum title length’ is closed
to new replies.

 * ![](https://ps.w.org/breadcrumb-navxt/assets/icon.svg?rev=1927103)
 * [Breadcrumb NavXT](https://wordpress.org/plugins/breadcrumb-navxt/)
 * [Support Threads](https://wordpress.org/support/plugin/breadcrumb-navxt/)
 * [Active Topics](https://wordpress.org/support/plugin/breadcrumb-navxt/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/breadcrumb-navxt/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/breadcrumb-navxt/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [John Havlik](https://wordpress.org/support/users/mtekk/)
 * Last activity: [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-breadcrumb-navxt-problem-with-maximum-title-length/#post-2825992)
 * Status: not resolved