My theme contains the following to create permalinks:

<h3><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>

However I want to translate the "Permanent link to" text.

How do I do that?

Thank you.

  • the_title_attribute function should not prepend the text "Permant link to", your theme possibly using the_title hook to add the string. Look on your theme where it says add_filter('the_title', ''); and if they have used gettext then you can translate it. Otherwise you will need to edit it on the theme file.
    – Shazzad
    Jan 2, 2014 at 13:48
  • Thanks, I cannot find an add_filter command in the theme's files. Thank you.
    – p.a.
    Jan 2, 2014 at 14:23

1 Answer 1


one possible way:

$link_text = sprintf( 
                 __( 'Permanent link to %s', 'youthemetextdomain'),
                 get_the_title() ); ?>

    href='<?php the_permalink(); ?>'
    title='<?php the_title_attribute(); ?>'
><?php echo $link_text; ?></a></h3>

get_the_title() returns the title instead of displaying it. The double-underscore function is how WordPress allows strings to be extracted from a theme or plugin for translation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.