",
self::$meta_prefix . 'meta-robots-adv'
);
$oldies = $wpdb->get_results( $query );
if ( is_array( $oldies ) && $oldies !== [] ) {
foreach ( $oldies as $old ) {
$clean = self::validate_meta_robots_adv( $old->meta_value );
if ( $clean !== $old->meta_value ) {
if ( $clean !== self::$meta_fields['advanced']['meta-robots-adv']['default_value'] ) {
update_metadata_by_mid( 'post', $old->meta_id, $clean );
}
else {
delete_metadata_by_mid( 'post', $old->meta_id );
}
}
}
}
unset( $query, $oldies, $old, $clean );
do_action( 'wpseo_meta_clean_up' );
}
/**
* Recursively merge a variable number of arrays, using the left array as base,
* giving priority to the right array.
*
* Difference with native array_merge_recursive():
* array_merge_recursive converts values with duplicate keys to arrays rather than
* overwriting the value in the first array with the duplicate value in the second array.
*
* array_merge_recursive_distinct does not change the data types of the values in the arrays.
* Matching keys' values in the second array overwrite those in the first array, as is the
* case with array_merge.
*
* Freely based on information found on http://www.php.net/manual/en/function.array-merge-recursive.php
*
* {@internal Should be moved to a general utility class.}}
*
* @return array
*/
public static function array_merge_recursive_distinct() {
$arrays = func_get_args();
if ( count( $arrays ) < 2 ) {
if ( $arrays === [] ) {
return [];
}
else {
return $arrays[0];
}
}
$merged = array_shift( $arrays );
foreach ( $arrays as $array ) {
foreach ( $array as $key => $value ) {
if ( is_array( $value ) && ( isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) ) {
$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
}
else {
$merged[ $key ] = $value;
}
}
unset( $key, $value );
}
return $merged;
}
/**
* Counts the total of all the keywords being used for posts except the given one.
*
* @param string $keyword The keyword to be counted.
* @param int $post_id The id of the post to which the keyword belongs.
*
* @return array
*/
public static function keyword_usage( $keyword, $post_id ) {
if ( empty( $keyword ) ) {
return [];
}
/**
* The indexable repository.
*
* @var Indexable_Repository
*/
$repository = YoastSEO()->classes->get( Indexable_Repository::class );
$post_ids = $repository->query()
->select( 'object_id' )
->where( 'primary_focus_keyword', $keyword )
->where( 'object_type', 'post' )
->where_not_equal( 'object_id', $post_id )
->where_not_equal( 'post_status', 'trash' )
->limit( 2 ) // Limit to 2 results to save time and resources.
->find_array();
// Get object_id from each subarray in $post_ids.
$post_ids = ( is_array( $post_ids ) ) ? array_column( $post_ids, 'object_id' ) : [];
/*
* If Premium is installed, get the additional keywords as well.
* We only check for the additional keywords if we've not already found two.
* In that case there's no use for an additional query as we already know
* that the keyword has been used multiple times before.
*/
if ( count( $post_ids ) < 2 ) {
/**
* Allows enhancing the array of posts' that share their focus keywords with the post's focus keywords.
*
* @param array $post_ids The array of posts' ids that share their related keywords with the post.
* @param string $keyword The keyword to search for.
* @param int $post_id The id of the post the keyword is associated to.
*/
$post_ids = apply_filters( 'wpseo_posts_for_focus_keyword', $post_ids, $keyword, $post_id );
}
return $post_ids;
}
/**
* Returns the post types for the given post ids.
*
* @param array $post_ids The post ids to get the post types for.
*
* @return array The post types.
*/
public static function post_types_for_ids( $post_ids ) {
/**
* The indexable repository.
*
* @var Indexable_Repository
*/
$repository = YoastSEO()->classes->get( Indexable_Repository::class );
// Check if post ids is not empty.
if ( ! empty( $post_ids ) ) {
// Get the post subtypes for the posts that share the keyword.
$post_types = $repository->query()
->select( 'object_sub_type' )
->where_in( 'object_id', $post_ids )
->find_array();
// Get object_sub_type from each subarray in $post_ids.
$post_types = array_column( $post_types, 'object_sub_type' );
}
else {
$post_types = [];
}
return $post_types;
}
/**
* Filter the schema article types.
*
* @return void
*/
public static function filter_schema_article_types() {
/** This filter is documented in inc/options/class-wpseo-option-titles.php */
self::$meta_fields['schema']['schema_article_type']['options'] = apply_filters( 'wpseo_schema_article_types', self::$meta_fields['schema']['schema_article_type']['options'] );
}
}
Fatal error: Uncaught Error: Class 'WPSEO_Meta' not found in /home/healths/public_html/wp-content/plugins/wordpress-seo/wp-seo-main.php:342
Stack trace:
#0 /home/healths/public_html/wp-includes/class-wp-hook.php(324): wpseo_init()
#1 /home/healths/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#2 /home/healths/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
#3 /home/healths/public_html/wp-settings.php(506): do_action()
#4 /home/healths/public_html/wp-config.php(99): require_once('/home/healths/p...')
#5 /home/healths/public_html/wp-load.php(50): require_once('/home/healths/p...')
#6 /home/healths/public_html/wp-blog-header.php(13): require_once('/home/healths/p...')
#7 /home/healths/public_html/index.php(17): require('/home/healths/p...')
#8 {main}
thrown in /home/healths/public_html/wp-content/plugins/wordpress-seo/wp-seo-main.php on line 342