// if no title function simplehomepage_custom_document_title() { if (!get_the_title()&&get_the_content()){ return esc_html(wp_trim_words(get_the_content(), 20, '...') . " – " . get_bloginfo('name')); } } add_filter( 'pre_get_document_title', 'simplehomepage_custom_document_title');
Is this WordPress function safe? This is my own WordPress theme, this function is in the function.php file. About the function: If the post does not have a title, then the title is taken from the content. #WP #WordPress #theme #PHP #coding #programming (updated screenshot)