-
-
Save freddielore/d4e4d6d0fcc73944c762c2747f605da1 to your computer and use it in GitHub Desktop.
[Smart SEO Export Facebook Open Graph] Using smart_seo_export_fields filter to export Facebook Open Graph meta data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Export OpenGraph meta data */ | |
add_filter( 'smart_seo_export_fields', 'smartseo_export_opengraph_metas', 8, 1 ); | |
function smartseo_export_opengraph_metas( $fields ){ | |
$fields[] = '_yoast_wpseo_opengraph-title'; | |
$fields[] = '_yoast_wpseo_opengraph-description'; | |
return $fields; | |
} | |
/** Include OpenGraph meta data in bulk csv update */ | |
add_action( 'smart_seo_import_update', 'smartseo_update_more_custom_fields', 10, 2 ); | |
function smartseo_update_more_custom_fields($post_id, $data){ | |
update_post_meta( $post_id, '_yoast_wpseo_opengraph-title', sanitize_text_field( $data['_yoast_wpseo_opengraph-title']) ); | |
update_post_meta( $post_id, '_yoast_wpseo_opengraph-description', sanitize_text_field( $data['_yoast_wpseo_opengraph-description']) ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment