Using WordPress ‘link_title’ PHP filter

The link_title WordPress PHP Filter allows you to modify the OPML outline link title text.

Usage

add_filter('link_title', 'your_custom_function');
function your_custom_function($title) {
  // your custom code here
  return $title;
}

Parameters

  • $title (string) – The OPML outline title text.

More information

See WordPress Developer Resources: link_title

Examples

Make the link title text uppercase.

add_filter('link_title', 'uppercase_link_title');
function uppercase_link_title($title) {
  return strtoupper($title);
}

Add a prefix to the link title text.

add_filter('link_title', 'add_prefix_to_link_title');
function add_prefix_to_link_title($title) {
  return 'Prefix - ' . $title;
}

Add a suffix to the link title text.

add_filter('link_title', 'add_suffix_to_link_title');
function add_suffix_to_link_title($title) {
  return $title . ' - Suffix';
}

Replace specific text in the link title.

add_filter('link_title', 'replace_text_in_link_title');
function replace_text_in_link_title($title) {
  return str_replace('Old Text', 'New Text', $title);
}

Remove all numbers from the link title text.

add_filter('link_title', 'remove_numbers_from_link_title');
function remove_numbers_from_link_title($title) {
  return preg_replace('/[0-9]/', '', $title);
}