Skip to content

Instantly share code, notes, and snippets.

@mattradford
Last active June 19, 2022 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattradford/a640c0af118c603ffdf24cf6d290c03c to your computer and use it in GitHub Desktop.
Save mattradford/a640c0af118c603ffdf24cf6d290c03c to your computer and use it in GitHub Desktop.
Translate the GeneratePress 404 page title using Polylang strings translation
/**
* Translate the GeneratePress 404 page title
*
* The string can be translated in Languages -> Strings translations
*/
if ( function_exists( 'pll_register_string' ) ) {
function mattrad_404_text() {
$error_text = 'That page cannot be found';
pll_register_string( '404', $error_text , 'text_domain');
return pll__( $error_text );
}
add_filter( 'generate_404_title', 'mattrad_404_text' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment