Merged in feature/MAW-855-import-code-into-aws (pull request #2)

code import from pantheon

* code import from pantheon
This commit is contained in:
Tony Volpe
2023-12-04 23:08:14 +00:00
parent 8c9b1312bc
commit 8f4b5efda6
4766 changed files with 185592 additions and 239967 deletions

View File

@@ -496,14 +496,20 @@ class WPSEO_Image_Utils {
*/
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 );
}
if ( $image_id ) {
return $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 );
}
// Only store a new ID if it is not 0, to prevent an update loop.
if ( $image_id ) {
WPSEO_Options::set( $setting . '_id', $image_id );
}
return $image_id;