-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add meta title, descirption, and robots support. (a previous commit w…
…as mislabeled; only supported social title/description previously.)
- Loading branch information
Tim Gieseking
committed
Jun 6, 2019
1 parent
2b1ff6e
commit aed71fe
Showing
1 changed file
with
20 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
/** | ||
* Plugin Name: Distributor / Yoast Sync | ||
* Plugin URI: https://github.com/timstl/distributor-yoast-sync | ||
* Description: Sync social images, meta titles and descriptions from Yoast SEO when post is pushed or pulled by Distributor plugin. | ||
* Version: 1.0.2 | ||
* Description: Sync social images, titles and descriptions and meta information from Yoast SEO when post is pushed or pulled by Distributor plugin. | ||
* Version: 1.0.3 | ||
* Author: Tim Gieseking, [email protected] | ||
* Author URI: http://timgweb.com/ | ||
* License: GPL-2.0+ | ||
|
@@ -40,10 +40,14 @@ function dty_yoast_meta_keys( $prepend = '_' ) { | |
array( | ||
'yoast_wpseo_opengraph-image' => 'image', | ||
'yoast_wpseo_twitter-image' => 'image', | ||
'yoast_wpseo_title' => 'text', | ||
'yoast_wpseo_opengraph-title' => 'text', | ||
'yoast_wpseo_twitter-title' => 'text', | ||
'yoast_wpseo_metadesc' => 'textarea', | ||
'yoast_wpseo_opengraph-description' => 'textarea', | ||
'yoast_wpseo_twitter-description' => 'textarea', | ||
'yoast_wpseo_meta-robots-noindex' => 'int', | ||
'yoast_wpseo_meta-robots-nofollow' => 'int', | ||
) | ||
); | ||
|
||
|
@@ -165,6 +169,20 @@ function dty_fix_opengraph_meta_on_update( $post_body, $post ) { | |
unset( $post_body['post_data']['distributor_meta'][ '_' . $yoast_meta_key ] ); | ||
} | ||
} | ||
} elseif ( 'int' === $type ) { | ||
/** | ||
* Sanitize integers (robot settings); | ||
*/ | ||
if ( isset( $_POST[ $yoast_meta_key ] ) ) { | ||
$post_body['post_data']['distributor_meta'][ '_' . $yoast_meta_key ][0] = intval( $_POST[ $yoast_meta_key ] ); | ||
} else { | ||
/** | ||
* Delete | ||
*/ | ||
if ( isset( $post_body['post_data']['distributor_meta'][ '_' . $yoast_meta_key ] ) ) { | ||
unset( $post_body['post_data']['distributor_meta'][ '_' . $yoast_meta_key ] ); | ||
} | ||
} | ||
} | ||
} | ||
|
||
|