); // Publish Schema Template post. if ( 'rank_math_schema' === $post->post_type && 'publish' !== $post->post_status ) { wp_update_post( [ 'ID' => $post_id, 'post_status' => 'publish', ] ); } } /** * Add excluded template conditions in the Schema template and remove it from the metadata. * * @param array $meta Meta data to update. * @param WP_REST_Request $request Full details about the request. * * @return array Processed metadata. */ public function filter_metadata( $meta, $request ) { foreach ( $meta as $meta_key => $meta_value ) { if ( ! Str::starts_with( 'rank_math_exclude_template_', $meta_key ) ) { continue; } $template_id = absint( \str_replace( 'rank_math_exclude_template_', '', $meta_key ) ); $schema_data = DB::get_schemas( $template_id ); $meta_id = key( $schema_data ); $meta_key = 'rank_math_schema_' . $schema_data[ $meta_id ]['@type']; $schema_data[ $meta_id ]['metadata']['displayConditions'][] = [ 'condition' => 'exclude', 'category' => 'singular', 'type' => $request->get_param( 'objectType' ), 'value' => $request->get_param( 'objectID' ), ]; $db_id = absint( str_replace( 'schema-', '', $meta_id ) ); update_metadata_by_mid( 'post', $db_id, $schema_data[ $meta_id ], $meta_key ); unset( $meta[ "rank_math_exclude_template_{$template_id}" ] ); } return $meta; } /** * [get_schema_templates description] * * @return array */ protected function get_schema_templates() { $posts = get_posts( [ 'post_type' => 'rank_math_schema', 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', ] ); if ( empty( $posts ) ) { return []; } $templates = []; foreach ( $posts as $post ) { $data = DB::get_template_type( $post->ID ); $data['title'] = $post->post_title; $data['id'] = $post->ID; $templates[] = $data; } return $templates; } /** * Whether to enqueue schema scripts on the page. * * @return bool */ private function can_enqueue_scripts() { if ( ! Helper::has_cap( 'onpage_snippet' ) ) { return false; } if ( ! Helper::is_divi_frontend_editor() && ! is_admin() ) { return false; } global $pagenow; if ( 'edit-tags.php' === $pagenow ) { return false; } if ( Admin_Helper::is_term_edit() ) { $taxonomy = Param::request( 'taxonomy' ); return true !== apply_filters( 'rank_math/snippet/remove_taxonomy_data', Helper::get_settings( 'titles.remove_' . $taxonomy . '_snippet_data' ), $taxonomy ); } return ( Admin_Helper::is_post_edit() || Helper::is_divi_frontend_editor() ) && ! Admin_Helper::is_posts_page(); } /** * Add active templates to the schemas json * * @return array */ private function get_active_templates() { $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; if ( $screen instanceof WP_Screen && 'rank_math_schema' === $screen->post_type ) { return []; } $templates = Display_Conditions::get_schema_templates(); if ( empty( $templates ) ) { return []; } $schemas = []; foreach ( $templates as $template ) { $template['schema']['isTemplate'] = true; $schemas[ $template['id'] ] = $template['schema']; } return $schemas; } /** * Localized data. */ private function localize_data() { $post = get_post(); Helper::add_json( 'postStatus', get_post_field( 'post_status', $post ) ); Helper::add_json( 'postLink', get_permalink( $post ) ); Helper::add_json( 'schemaTemplates', $this->get_schema_templates() ); Helper::add_json( 'activeTemplates', $this->get_active_templates() ); Helper::add_json( 'accessiblePostTypes', Helper::get_accessible_post_types() ); Helper::add_json( 'accessibleTaxonomies', Helper::get_accessible_taxonomies() ); Helper::add_json( 'postTaxonomies', $this->get_post_taxonomies() ); } /** * Get Post taxonomies. */ private function get_post_taxonomies() { $post_types = Helper::get_accessible_post_types(); $data = []; foreach ( $post_types as $post_type ) { $taxonomies = Helper::get_object_taxonomies( $post_type ); if ( empty( $taxonomies ) ) { continue; } unset( $taxonomies['off'] ); $data[ $post_type ] = [ 'all' => esc_html__( 'All Taxonomies', 'rank-math-pro' ) ] + $taxonomies; } return $data; } }
Fatal error: Uncaught Error: Class 'RankMathPro\Schema\Admin' not found in /home/candoodesigncom/public_html/wp-content/plugins/seo-by-rank-math-pro/includes/modules/schema/class-schema.php:38 Stack trace: #0 /home/candoodesigncom/public_html/wp-content/plugins/seo-by-rank-math-pro/includes/modules/schema/class-schema.php(30): RankMathPro\Schema\Schema->includes() #1 /home/candoodesigncom/public_html/wp-content/plugins/seo-by-rank-math/includes/module/class-manager.php(487): RankMathPro\Schema\Schema->__construct() #2 /home/candoodesigncom/public_html/wp-content/plugins/seo-by-rank-math/includes/module/class-manager.php(467): RankMath\Module\Manager->load_module('rich-snippet', Object(RankMath\Module\Module)) #3 /home/candoodesigncom/public_html/wp-includes/class-wp-hook.php(324): RankMath\Module\Manager->load_modules('') #4 /home/candoodesigncom/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #5 /home/candoodesigncom/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #6 in /home/candoodesigncom/public_html/wp-content/plugins/seo-by-rank-math-pro/includes/modules/schema/class-schema.php on line 38