Changeset 3290074
- Timestamp:
- 05/08/2025 05:53:32 PM (11 months ago)
- Location:
- sapientseo
- Files:
-
- 6 edited
- 1 copied
-
tags/1.0.12 (copied) (copied from sapientseo/trunk)
-
tags/1.0.12/inc/api/posts.php (modified) (4 diffs)
-
tags/1.0.12/readme.txt (modified) (1 diff)
-
tags/1.0.12/sapientseo.php (modified) (1 diff)
-
trunk/inc/api/posts.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/sapientseo.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sapientseo/tags/1.0.12/inc/api/posts.php
r3290061 r3290074 127 127 // 🔹 Create Post 128 128 function sapient_seo_create_post(WP_REST_Request $request) { 129 $params = $request->get_json_params(); 130 $title = sanitize_text_field($params['title'] ?? ''); 131 $content = wp_kses_post($params['content'] ?? ''); 132 $status = in_array($params['status'] ?? '', ['draft', 'publish']) ? $params['status'] : 'draft'; 129 $params = $request->get_json_params(); 130 $title = sanitize_text_field($params['title'] ?? ''); 131 $content = wp_kses_post($params['content'] ?? ''); 132 $excerpt = sanitize_text_field($params['excerpt'] ?? ''); 133 $status = in_array($params['status'] ?? '', ['draft', 'publish', 'future', 'pending']) ? $params['status'] : 'draft'; 134 $type = sanitize_text_field($params['post_type'] ?? 'post'); 135 $postDate = !empty($params['post_date']) ? sanitize_text_field($params['post_date']) : current_time('mysql'); 133 136 134 137 if (empty($title)) { … … 137 140 138 141 $post_data = [ 139 'post_title' => $title, 140 'post_content' => $content, 141 'post_status' => $status, 142 'post_type' => 'post', 142 'post_title' => $title, 143 'post_content' => $content, 144 'post_excerpt' => $excerpt, 145 'post_status' => $status, 146 'post_type' => $type, 147 'post_date' => $postDate, 143 148 ]; 144 149 … … 256 261 } 257 262 258 // Collect all ACF fields for this post type, even if not filled263 // ACF fields 259 264 $acf = []; 260 265 if (function_exists('acf_get_field_groups')) { … … 283 288 'id' => $post_id, 284 289 'title' => get_the_title($post), 290 'excerpt' => get_the_excerpt($post), 291 'status' => $post->post_status, 292 'post_type' => $post->post_type, 285 293 'slug' => $post->post_name, 286 'status' => $post->post_status,287 'excerpt' => get_the_excerpt($post),288 'content' => apply_filters('the_content', $post->post_content),289 294 'url' => get_permalink($post_id), 290 295 'created_at' => get_the_date('c', $post), -
sapientseo/tags/1.0.12/readme.txt
r3290061 r3290074 4 4 Tested up to: 6.8 5 5 Requires PHP: 7.4 6 Stable tag: 1.0.1 16 Stable tag: 1.0.12 7 7 License: GPLv2 or later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
sapientseo/tags/1.0.12/sapientseo.php
r3290061 r3290074 3 3 * Plugin Name: SapientSEO 4 4 * Description: Connect your WordPress site to SapientSEO using secure custom REST API endpoints. 5 * Version: 1.0.1 15 * Version: 1.0.12 6 6 * Author: SapientSEO 7 7 * Plugin URI: https://sapientseo.ai -
sapientseo/trunk/inc/api/posts.php
r3290061 r3290074 127 127 // 🔹 Create Post 128 128 function sapient_seo_create_post(WP_REST_Request $request) { 129 $params = $request->get_json_params(); 130 $title = sanitize_text_field($params['title'] ?? ''); 131 $content = wp_kses_post($params['content'] ?? ''); 132 $status = in_array($params['status'] ?? '', ['draft', 'publish']) ? $params['status'] : 'draft'; 129 $params = $request->get_json_params(); 130 $title = sanitize_text_field($params['title'] ?? ''); 131 $content = wp_kses_post($params['content'] ?? ''); 132 $excerpt = sanitize_text_field($params['excerpt'] ?? ''); 133 $status = in_array($params['status'] ?? '', ['draft', 'publish', 'future', 'pending']) ? $params['status'] : 'draft'; 134 $type = sanitize_text_field($params['post_type'] ?? 'post'); 135 $postDate = !empty($params['post_date']) ? sanitize_text_field($params['post_date']) : current_time('mysql'); 133 136 134 137 if (empty($title)) { … … 137 140 138 141 $post_data = [ 139 'post_title' => $title, 140 'post_content' => $content, 141 'post_status' => $status, 142 'post_type' => 'post', 142 'post_title' => $title, 143 'post_content' => $content, 144 'post_excerpt' => $excerpt, 145 'post_status' => $status, 146 'post_type' => $type, 147 'post_date' => $postDate, 143 148 ]; 144 149 … … 256 261 } 257 262 258 // Collect all ACF fields for this post type, even if not filled263 // ACF fields 259 264 $acf = []; 260 265 if (function_exists('acf_get_field_groups')) { … … 283 288 'id' => $post_id, 284 289 'title' => get_the_title($post), 290 'excerpt' => get_the_excerpt($post), 291 'status' => $post->post_status, 292 'post_type' => $post->post_type, 285 293 'slug' => $post->post_name, 286 'status' => $post->post_status,287 'excerpt' => get_the_excerpt($post),288 'content' => apply_filters('the_content', $post->post_content),289 294 'url' => get_permalink($post_id), 290 295 'created_at' => get_the_date('c', $post), -
sapientseo/trunk/readme.txt
r3290061 r3290074 4 4 Tested up to: 6.8 5 5 Requires PHP: 7.4 6 Stable tag: 1.0.1 16 Stable tag: 1.0.12 7 7 License: GPLv2 or later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
sapientseo/trunk/sapientseo.php
r3290061 r3290074 3 3 * Plugin Name: SapientSEO 4 4 * Description: Connect your WordPress site to SapientSEO using secure custom REST API endpoints. 5 * Version: 1.0.1 15 * Version: 1.0.12 6 6 * Author: SapientSEO 7 7 * Plugin URI: https://sapientseo.ai
Note: See TracChangeset
for help on using the changeset viewer.