<?php
/**
* The Metadata.
*
* @since 0.9.0
* @package RankMath
* @subpackage RankMath\Traits
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Traits;
use RankMath\Helper;
defined( 'ABSPATH' ) || exit;
/**
* Meta class.
*/
trait Meta {
/**
* Get meta by object type.
*
* @param string $object_type Object type for destination where to save.
* @param int $object_id Object id for destination where to save.
* @param string $key The meta key to retrieve. If no key is provided, fetches all metadata.
* @param bool $single Whether to return a single value.
*
* @return mixed
*/
public function get_meta( $object_type, $object_id, $key = '', $single = true ) {
$func = "get_{$object_type}_meta";
$value = $func( $object_id, $key, $single );
if ( $key === 'rank_math_focus_keyword' && ! is_string( $value ) ) {
return '';
}
return $value;
}
/**
* Update meta by object type.
*
* @param string $object_type Object type for destination where to save.
* @param int $object_id Object id for destination where to save.
* @param string $key Metadata key.
* @param mixed $value Metadata value.
*
* @return mixed
*/
public function update_meta( $object_type, $object_id, $key, $value ) {
$func = "update_{$object_type}_meta";
if ( is_string( $key ) && is_protected_meta( $key ) && ( is_scalar( $value ) || is_array( $value ) ) ) {
return $func( $object_id, $key, $value );
}
return false;
}
}
| nama | waktu | ukuran | owner | perm | aksi |
|---|---|---|---|---|---|
| .. | |||||
| class-ajax.php | 2026-07-21 14:14 | 2.66 KB | 76129f60960:kunden | -xw-x----- | |
| class-cache.php | 2026-07-21 14:14 | 2.55 KB | 76129f60960:kunden | -xw-x----- | |
| class-hooker.php | 2026-07-21 14:14 | 4.57 KB | 76129f60960:kunden | -xw-x----- | |
| class-meta.php | 2026-07-21 14:14 | 1.5 KB | 76129f60960:kunden | -xw-x----- | |
| class-shortcode.php | 2026-07-21 14:14 | 749 B | 76129f60960:kunden | -xw-x----- | |
| class-wizard.php | 2026-07-21 14:14 | 585 B | 76129f60960:kunden | -xw-x----- | |
| index.php | 2026-07-21 14:14 | 28 B | 76129f60960:kunden | -xw-x----- | |