Changeset 2387022
- Timestamp:
- 09/23/2020 10:33:02 AM (6 years ago)
- File:
-
- 1 edited
-
contentstudio/trunk/contentstudio-plugin.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
contentstudio/trunk/contentstudio-plugin.php
r2386082 r2387022 20 20 if (isset($post->ID)) { 21 21 if ($post->post_type == 'post') { 22 $meta_title = get_post_meta($post->ID, ' contentstudio_wpseo_title');22 $meta_title = get_post_meta($post->ID, 'wpseo_title'); 23 23 24 24 return $meta_title[0]; … … 29 29 30 30 add_filter('pre_get_document_title', 'cstu_add_wpseo_title'); 31 add_filter('wpseo_title', 'filter_product_wpseo_title'); 32 function filter_product_wpseo_title($title) { 33 if( is_singular( 'product') ) { 34 $title = $meta_title = sanitize_text_field($_REQUEST['post']['post_meta_title']); 35 } 36 return $title; 37 } 31 38 32 39 // Check for existing class … … 139 146 if ($post) { 140 147 if (isset($post->ID)) { 141 $meta_description = get_post_meta($post->ID, ' contentstudio_wpseo_description');148 $meta_description = get_post_meta($post->ID, 'wpseo_description'); 142 149 if ($meta_description) { 143 150 echo '<meta name="description" content="'.$meta_description[0].'" />'."\n"; … … 796 803 } 797 804 if ($meta_description) { 798 if (! get_post_meta($get_post->ID, ' contentstudio_wpseo_description')) {799 add_post_meta($get_post->ID, ' contentstudio_wpseo_description', $meta_description, true);805 if (! get_post_meta($get_post->ID, 'wpseo_description')) { 806 add_post_meta($get_post->ID, 'wpseo_description', $meta_description, true); 800 807 } else { 801 update_post_meta($get_post->ID, ' contentstudio_wpseo_description', $meta_description);808 update_post_meta($get_post->ID, 'wpseo_description', $meta_description); 802 809 } 803 810 } … … 808 815 809 816 if ($meta_title) { 810 if (! get_post_meta($get_post->ID, ' contentstudio_wpseo_title')) {811 add_post_meta($get_post->ID, ' contentstudio_wpseo_title', $meta_title, true);817 if (! get_post_meta($get_post->ID, 'wpseo_title')) { 818 add_post_meta($get_post->ID, 'wpseo_title', $meta_title, true); 812 819 } else { 813 update_post_meta($get_post->ID, ' contentstudio_wpseo_title', $meta_title);820 update_post_meta($get_post->ID, 'wpseo_title', $meta_title); 814 821 } 815 822 } … … 838 845 public function set_cstu_yoast_settinsg($post) 839 846 { 840 if ($this->is_yoast_active()) {847 //if ($this->is_yoast_active()) { 841 848 global $wpdb; 842 849 $sql = $wpdb->prepare("select object_id from ".$wpdb->prefix."yoast_seo_meta where object_id='%d'", $post->ID); … … 852 859 "post_id" => $post->ID, 853 860 "meta_key" => "_yoast_wpseo_title", 854 "meta_value" => sanitize_text_field($_REQUEST['post']['post_meta_title']),861 "meta_value" => $_REQUEST['post']['post_meta_title'], 855 862 ]); 856 863 $wpdb->insert($wpdb->postmeta, [ 857 864 "post_id" => $post->ID, 858 865 "meta_key" => "_yoast_wpseo_metadesc", 859 "meta_value" => sanitize_text_field($_REQUEST['post']['post_meta_description']),866 "meta_value" => $_REQUEST['post']['post_meta_description'], 860 867 ]); 861 } 862 } 868 //} 869 } 870 871 863 872 864 873 /**
Note: See TracChangeset
for help on using the changeset viewer.