WPSEO_Upgrade::copy_og_settings_from_social_to_titles
Copies the frontpage social settings to the titles options.
Метод класса: WPSEO_Upgrade{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$WPSEO_Upgrade = new WPSEO_Upgrade(); $WPSEO_Upgrade->copy_og_settings_from_social_to_titles();
Код WPSEO_Upgrade::copy_og_settings_from_social_to_titles() WPSEO Upgrade::copy og settings from social to titles Yoast 27.3
public function copy_og_settings_from_social_to_titles() {
$wpseo_social = get_option( 'wpseo_social' );
$wpseo_titles = get_option( 'wpseo_titles' );
$copied_options = [];
// Reset to the correct default value.
$copied_options['open_graph_frontpage_title'] = '%%sitename%%';
$options = [
'og_frontpage_title' => 'open_graph_frontpage_title',
'og_frontpage_desc' => 'open_graph_frontpage_desc',
'og_frontpage_image' => 'open_graph_frontpage_image',
'og_frontpage_image_id' => 'open_graph_frontpage_image_id',
];
foreach ( $options as $social_option => $titles_option ) {
if ( ! empty( $wpseo_social[ $social_option ] ) ) {
$copied_options[ $titles_option ] = $wpseo_social[ $social_option ];
}
}
$wpseo_titles = array_merge( $wpseo_titles, $copied_options );
update_option( 'wpseo_titles', $wpseo_titles );
}