Changeset 3186366
- Timestamp:
- 11/12/2024 09:18:46 AM (17 months ago)
- Location:
- writerx/trunk
- Files:
-
- 3 edited
-
includes/create-post.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
writerx.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
writerx/trunk/includes/create-post.php
r3179831 r3186366 131 131 } 132 132 133 /* Yoast SEO meta */ 134 if (isset($parameters['keywords'])) { 135 // Yoast SEO stores keywords in the '_yoast_wpseo_focuskw' meta field 136 update_post_meta($new_post_id, '_yoast_wpseo_focuskw', sanitize_text_field($parameters['keywords'])); 137 } 138 139 if (isset($parameters['description'])) { 140 // Yoast SEO stores the meta description in the '_yoast_wpseo_metadesc' meta field 141 update_post_meta($new_post_id, '_yoast_wpseo_metadesc', sanitize_text_field($parameters['description'])); 142 } 143 144 /* All in One SEO meta */ 145 if (isset($parameters['description']) || isset($parameters['keywords'])) { 146 global $wpdb; 147 148 // Sanitize and process the description 149 $description = isset($parameters['description']) ? sanitize_text_field($parameters['description']) : ''; 150 151 // Sanitize and process the keyphrase 152 $keyphrase = isset($parameters['keywords']) ? sanitize_text_field($parameters['keywords']) : ''; 153 154 // Prepare the value for the keyphrases field 155 $keyphrases_data = [ 156 "focus" => [ 157 "keyphrase" => $keyphrase, 158 "score" => 0, // You can set your own value 159 "analysis" => [ 160 "keyphraseInTitle" => ["score" => 0, "maxScore" => 9, "error" => 0], 161 "keyphraseInDescription" => ["score" => 0, "maxScore" => 9, "error" => 0], 162 "keyphraseLength" => ["score" => strlen($keyphrase), "maxScore" => 9, "error" => 0, "length" => strlen($keyphrase)], 163 "keyphraseInURL" => ["score" => 0, "maxScore" => 5, "error" => 0], 164 "keyphraseInIntroduction" => ["score" => 0, "maxScore" => 9, "error" => 0], 165 "keyphraseInSubHeadings" => [], 166 "keyphraseInImageAlt" => [], 167 "keywordDensity" => ["score" => 0, "type" => "low", "maxScore" => 9, "error" => 0] 168 ] 169 ], 170 "additional" => [] 171 ]; 172 173 // Check if the record exists in the wp_aioseo_posts table 174 $post_exists = $wpdb->get_var($wpdb->prepare( 175 "SELECT COUNT(*) FROM wp_aioseo_posts WHERE post_id = %d", 176 $new_post_id 177 )); 178 179 if ($post_exists) { 180 // If the record exists, update the description and keyphrases 181 $wpdb->update( 182 'wp_aioseo_posts', 183 array( 184 'description' => $description, // Data for updating 185 'keyphrases' => json_encode($keyphrases_data) // Update keyphrases 186 ), 187 array('post_id' => $new_post_id) // Update conditions 188 ); 189 } else { 190 // If the record does not exist, create a new one 191 $wpdb->insert( 192 'wp_aioseo_posts', 193 array( 194 'post_id' => $new_post_id, 195 'description' => $description, 196 'keyphrases' => json_encode($keyphrases_data), // Fill keyphrases 197 ) 198 ); 199 } 200 201 // Update the field in the wp_postmeta table 202 update_post_meta($new_post_id, '_aioseop_description', $description); 203 } 204 133 205 $edit_post_url = admin_url('post.php?post=' . $new_post_id . '&action=edit'); 134 206 $preview_post_url = add_query_arg( 'preview', 'true', get_permalink($new_post_id) ); -
writerx/trunk/readme.txt
r3179831 r3186366 4 4 Requires at least: 5.0 5 5 Tested up to: 6.6 6 Stable tag: 1.3. 86 Stable tag: 1.3.9 7 7 License: GPLv2 or later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 37 37 38 38 == Changelog == 39 40 = 1.3.9 = 41 * Improved interaction with SEO plugins. 39 42 40 43 = 1.3.8 = -
writerx/trunk/writerx.php
r3179831 r3186366 3 3 Plugin Name: WriterX 4 4 Description: Enables connection with your WriterX account to generate content at scale 5 Version: 1.3. 85 Version: 1.3.9 6 6 Author: Astoria Company 7 7 Author URI: https://writerx.ai/
Note: See TracChangeset
for help on using the changeset viewer.