Last active
July 25, 2023 08:29
-
-
Save wp-seopress/0ebb575dcf5ad22d5be5af490ba6f033 to your computer and use it in GitHub Desktop.
Filter the request to generate a meta title with AI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('seopress_ai_openai_meta_title', 'sp_ai_openai_meta_title', 10, 2); | |
function sp_ai_openai_meta_title($prompt, $post_id) { | |
//$content = get_post_field('post_content', $post_id); | |
//$content = esc_attr(stripslashes_deep(wp_filter_nohtml_kses(wp_strip_all_tags(strip_shortcodes($content))))); | |
//$content = wp_trim_words( $content, 500 ); | |
$language = 'fr_FR'; //example with French locale, replace with your own language code | |
$prompt = 'Generate, in this language ' . $language . ', an engaging SEO title metadata in one sentence of sixty characters maximum for this article: ' . $content; | |
return $prompt; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment