wp_insert_post set WPSEO_Primary_Term
-
We are supporting Seo Yoast on the theme.
we have a system to insert posts from the frontend and in the phase of creating the post I set the primary term like this:/**
* WPSEO Primary Term
*
* @since ${SINCE}
*
* @param $taxonomy string The taxonomy name
* @param $postID int The post ID
* @param $term int The term ID
*/
private function wpseoPrimaryTerm($taxonomy, $postID, $term)
{
// Seo Yoast support primary term.
if (class_exists(‘WPSEO_Primary_Term’)) {
$primaryTermObject = new \WPSEO_Primary_Term($taxonomy, $postID);
$primaryTermObject->set_primary_term($term);
}
}the primary is set but I can not find the post in the archive.
We also have a filter system to filter posts even by categories but the post is not there.
I only find it if I update the post from backend.
Is it a problem you have already faced? How can I solve the problem ?
- The topic ‘wp_insert_post set WPSEO_Primary_Term’ is closed to new replies.