Is it possible to program values?

#75588
  • Resolved Daniel Capeluto
    Rank Math free

    Is it possible to program the SEO of pages (the focus keywords, Title, Content, etc..) such that it picks information from the page (such as the page title and some of the content) so that it doesn’t have to be entered page by page? Our site has hundreds and hundreds of pages.

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math today.

    Unfortunately there is no current feature in Rank math automate keywords for already existing posts. You can use the following snippet that was used to auto-fill the keyword using tags. With the help of a developer, you can customize it to fit your situation.

    function update_focus_keywords() {
    	$posts = get_posts(array(
    	'posts_per_page'	=> -1,
    	'post_type'		=> 'post' //replace post with the name of your post type
        ));
    	foreach($posts as $p){
    		if(get_the_tags($p->ID)){
    			foreach((get_the_tags($p->ID)) as $tag) {
                    $keywords[] = strtolower($tag->name);
                }
    		update_post_meta($p->ID,'rank_math_focus_keyword',implode(", ", array_unique($keywords)));
    		}
    	}
        
    }
    add_action( 'init', 'update_focus_keywords' );

    Hope it helps you. Thank you.​​​​​​

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘Is it possible to program values?’ is closed to new replies.