WPSEO_Import_Squirrly::retrieve_post_data
Retrieves the Squirrly SEO data for a post from the DB.
Метод класса: WPSEO_Import_Squirrly{}
Хуков нет.
Возвращает
Массив|true|false. Array of data or false.
Использование
// private - только в коде основоного (родительского) класса $result = $this->retrieve_post_data( $post_identifier );
- $post_identifier(int) (обязательный)
- Post ID.
Код WPSEO_Import_Squirrly::retrieve_post_data() WPSEO Import Squirrly::retrieve post data Yoast 27.3
private function retrieve_post_data( $post_identifier ) {
global $wpdb;
if ( is_numeric( $post_identifier ) ) {
$post_identifier = (int) $post_identifier;
$query_where = 'post_id = %d';
}
if ( ! is_numeric( $post_identifier ) ) {
$query_where = 'URL = %s';
}
$replacements = [
get_current_blog_id(),
$post_identifier,
];
$data = $wpdb->get_var(
$wpdb->prepare(
"SELECT seo FROM {$this->table_name} WHERE blog_id = %d AND " . $query_where,
$replacements,
),
);
if ( ! $data || is_wp_error( $data ) ) {
return false;
}
$data = maybe_unserialize( $data );
return $data;
}