Plugin Directory

Changeset 3290074


Ignore:
Timestamp:
05/08/2025 05:53:32 PM (11 months ago)
Author:
galbc
Message:

Release version 1.0.12

Location:
sapientseo
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • sapientseo/tags/1.0.12/inc/api/posts.php

    r3290061 r3290074  
    127127// 🔹 Create Post
    128128function 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');
    133136
    134137    if (empty($title)) {
     
    137140
    138141    $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,
    143148    ];
    144149
     
    256261    }
    257262
    258     // Collect all ACF fields for this post type, even if not filled
     263    // ACF fields
    259264    $acf = [];
    260265    if (function_exists('acf_get_field_groups')) {
     
    283288        'id'           => $post_id,
    284289        'title'        => get_the_title($post),
     290        'excerpt'      => get_the_excerpt($post),
     291        'status'       => $post->post_status,
     292        'post_type'    => $post->post_type,
    285293        'slug'         => $post->post_name,
    286         'status'       => $post->post_status,
    287         'excerpt'      => get_the_excerpt($post),
    288         'content'      => apply_filters('the_content', $post->post_content),
    289294        'url'          => get_permalink($post_id),
    290295        'created_at'   => get_the_date('c', $post),
  • sapientseo/tags/1.0.12/readme.txt

    r3290061 r3290074  
    44Tested up to: 6.8
    55Requires PHP: 7.4
    6 Stable tag: 1.0.11
     6Stable tag: 1.0.12
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • sapientseo/tags/1.0.12/sapientseo.php

    r3290061 r3290074  
    33 * Plugin Name: SapientSEO
    44 * Description: Connect your WordPress site to SapientSEO using secure custom REST API endpoints.
    5  * Version: 1.0.11
     5 * Version: 1.0.12
    66 * Author: SapientSEO
    77 * Plugin URI: https://sapientseo.ai
  • sapientseo/trunk/inc/api/posts.php

    r3290061 r3290074  
    127127// 🔹 Create Post
    128128function 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');
    133136
    134137    if (empty($title)) {
     
    137140
    138141    $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,
    143148    ];
    144149
     
    256261    }
    257262
    258     // Collect all ACF fields for this post type, even if not filled
     263    // ACF fields
    259264    $acf = [];
    260265    if (function_exists('acf_get_field_groups')) {
     
    283288        'id'           => $post_id,
    284289        'title'        => get_the_title($post),
     290        'excerpt'      => get_the_excerpt($post),
     291        'status'       => $post->post_status,
     292        'post_type'    => $post->post_type,
    285293        'slug'         => $post->post_name,
    286         'status'       => $post->post_status,
    287         'excerpt'      => get_the_excerpt($post),
    288         'content'      => apply_filters('the_content', $post->post_content),
    289294        'url'          => get_permalink($post_id),
    290295        'created_at'   => get_the_date('c', $post),
  • sapientseo/trunk/readme.txt

    r3290061 r3290074  
    44Tested up to: 6.8
    55Requires PHP: 7.4
    6 Stable tag: 1.0.11
     6Stable tag: 1.0.12
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • sapientseo/trunk/sapientseo.php

    r3290061 r3290074  
    33 * Plugin Name: SapientSEO
    44 * Description: Connect your WordPress site to SapientSEO using secure custom REST API endpoints.
    5  * Version: 1.0.11
     5 * Version: 1.0.12
    66 * Author: SapientSEO
    77 * Plugin URI: https://sapientseo.ai
Note: See TracChangeset for help on using the changeset viewer.