WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WPSEO_Image_Utils::get_attachment_id_from_settings() public Yoast 1.0

Retrieves an attachment ID for an image uploaded in the settings.

Due to self::get_attachment_by_url returning 0 instead of false.
0 is also a possibility when no ID is available.

{} Это метод класса: WPSEO_Image_Utils{}

Хуков нет.

Возвращает

int|true|false. The attachment id, or false or 0 if no ID is available.

Использование

$result = WPSEO_Image_Utils::get_attachment_id_from_settings( $setting );
$setting(строка) (обязательный)
The setting the image is stored in.

Код WPSEO_Image_Utils::get_attachment_id_from_settings() Yoast 17.3

public static function get_attachment_id_from_settings( $setting ) {
	$image_id = WPSEO_Options::get( $setting . '_id', false );
	if ( ! $image_id ) {
		$image = WPSEO_Options::get( $setting, false );
		if ( $image ) {
			// There is not an option to put a URL in an image field in the settings anymore, only to upload it through the media manager.
			// This means an attachment always exists, so doing this is only needed once.
			$image_id = self::get_attachment_by_url( $image );
			WPSEO_Options::set( $setting . '_id', $image_id );
		}
	}

	return $image_id;
}