* @param int $post_id The post ID. * @param string $main_taxonomy The main taxonomy. * * @return int|false The ID of the primary term, or `false` if the post ID is invalid. */ private function get_primary_term_id( $post_id, $main_taxonomy ) { $primary_term = $this->primary_term_repository->find_by_post_id_and_taxonomy( $post_id, $main_taxonomy, false ); if ( $primary_term ) { return $primary_term->term_id; } return \get_post_meta( $post_id, WPSEO_Meta::$meta_prefix . 'primary_' . $main_taxonomy, true ); } /** * Removes the primary category. * * @param int $post_id The post id to set primary taxonomy for. * @param string $main_taxonomy Name of the taxonomy that is set to be the primary one. * * @return void */ private function remove_primary_term( $post_id, $main_taxonomy ) { $primary_term = $this->primary_term_repository->find_by_post_id_and_taxonomy( $post_id, $main_taxonomy, false ); if ( $primary_term ) { $primary_term->delete(); } // Remove it from the post meta. \delete_post_meta( $post_id, WPSEO_Meta::$meta_prefix . 'primary_' . $main_taxonomy ); } /** * Builds the hierarchy for a post. * * @param WP_Post $post The post. * * @return void */ public function build_post_hierarchy( $post ) { if ( $this->post_type_helper->is_excluded( $post->post_type ) ) { return; } $indexable = $this->indexable_repository->find_by_id_and_type( $post->ID, 'post' ); if ( $indexable instanceof Indexable ) { $this->indexable_hierarchy_builder->build( $indexable ); } } }
Fatal error: Uncaught Error: Class "Yoast\WP\SEO\Values\Indexables\Indexable_Builder_Versions" not found in /htdocs/wp-content/plugins/wordpress-seo/src/generated/container.php:1520 Stack trace: #0 /htdocs/wp-content/plugins/wordpress-seo/src/generated/container.php(1534): Yoast\WP\SEO\Generated\Cached_Container->getIndexableAuthorBuilderService() #1 /htdocs/wp-content/plugins/wordpress-seo/src/generated/container.php(5513): Yoast\WP\SEO\Generated\Cached_Container->getIndexableBuilderService() #2 /htdocs/wp-content/plugins/wordpress-seo/vendor_prefixed/symfony/dependency-injection/Container.php(212): Yoast\WP\SEO\Generated\Cached_Container->getIndexableRepositoryService() #3 /htdocs/wp-content/plugins/wordpress-seo/vendor_prefixed/symfony/dependency-injection/Container.php(195): YoastSEO_Vendor\Symfony\Component\DependencyInjection\Container->make('Yoast\\WP\\SEO\\Re...', 1) #4 /htdocs/wp-content/plugins/wordpress-seo/src/surfaces/classes-surface.php(38): YoastSEO_Vendor\Symfony\Component\DependencyInjection\Container->get('Yoast\\WP\\SEO\\Re...') #5 /htdocs/wp-content/plugins/wordpress-seo/inc/class-wpseo-admin-bar-menu.php(134): Yoast\WP\SEO\Surfaces\Classes_Surface->get('Yoast\\WP\\SEO\\Re...') #6 /htdocs/wp-content/plugins/wordpress-seo/inc/wpseo-non-ajax-functions.php(20): WPSEO_Admin_Bar_Menu->__construct() #7 /htdocs/wp-includes/class-wp-hook.php(341): wpseo_initialize_admin_bar('') #8 /htdocs/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters(NULL, Array) #9 /htdocs/wp-includes/plugin.php(522): WP_Hook->do_action(Array) #10 /htdocs/wp-settings.php(764): do_action('wp_loaded') #11 /htdocs/wp-config.php(105): require_once('/htdocs/wp-sett...') #12 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #13 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #14 /htdocs/index.php(41): require('/htdocs/wp-blog...') #15 {main} thrown in /htdocs/wp-content/plugins/wordpress-seo/src/generated/container.php on line 1520