Plugin Directory

Changeset 3297636


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

Release version 1.0.29

Location:
sapientseo
Files:
6 edited
1 copied

Legend:

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

    r3297616 r3297636  
    285285
    286286                if ($field['type'] === 'image' && is_numeric($value)) {
    287                     $acf[$field['name']] = [
     287                    $acf->{$field['name']} = [
    288288                        'id'  => $value,
    289289                        'url' => wp_get_attachment_url($value),
     
    291291                    ];
    292292                } else {
    293                     $acf[$field['name']] = $value ?? '';
     293                    $acf->{$field['name']} = $value ?? '';
    294294                }
    295295            }
  • sapientseo/tags/1.0.29/readme.txt

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

    r3297616 r3297636  
    33 * Plugin Name: SapientSEO
    44 * Description: Connect your WordPress site to SapientSEO using secure custom REST API endpoints.
    5  * Version: 1.0.28
     5 * Version: 1.0.29
    66 * Author: SapientSEO
    77 * Plugin URI: https://sapientseo.ai
     
    3333
    3434/**
    35  * All REST endpoints use either permission callbacks or secure header validation (X-API-KEY) via sapient_seo_api_key_permission().
    36  */
    37 
    38  /**
    39  * Prevent full-page caching for SapientSEO REST API endpoints.
     35 * Prevent full-page caching for SapientSEO REST API endpoints (HTML rendering).
    4036 */
    4137add_action('template_redirect', 'sapientseo_template_redirect', 0);
     
    4743    }
    4844}
     45
     46/**
     47 * Prevent REST API response caching for SapientSEO endpoints.
     48 */
     49add_filter('rest_post_dispatch', function ($response, $server, $request) {
     50    if (strpos($request->get_route(), '/sapientseo/v1/') !== false) {
     51        if (is_object($response) && method_exists($response, 'header')) {
     52            $response->header('Cache-Control', 'no-cache, must-revalidate, max-age=0');
     53            $response->header('Pragma', 'no-cache');
     54            $response->header('Expires', '0');
     55        }
     56    }
     57    return $response;
     58}, 10, 3);
  • sapientseo/trunk/inc/api/posts.php

    r3297616 r3297636  
    285285
    286286                if ($field['type'] === 'image' && is_numeric($value)) {
    287                     $acf[$field['name']] = [
     287                    $acf->{$field['name']} = [
    288288                        'id'  => $value,
    289289                        'url' => wp_get_attachment_url($value),
     
    291291                    ];
    292292                } else {
    293                     $acf[$field['name']] = $value ?? '';
     293                    $acf->{$field['name']} = $value ?? '';
    294294                }
    295295            }
  • sapientseo/trunk/readme.txt

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

    r3297616 r3297636  
    33 * Plugin Name: SapientSEO
    44 * Description: Connect your WordPress site to SapientSEO using secure custom REST API endpoints.
    5  * Version: 1.0.28
     5 * Version: 1.0.29
    66 * Author: SapientSEO
    77 * Plugin URI: https://sapientseo.ai
     
    3333
    3434/**
    35  * All REST endpoints use either permission callbacks or secure header validation (X-API-KEY) via sapient_seo_api_key_permission().
    36  */
    37 
    38  /**
    39  * Prevent full-page caching for SapientSEO REST API endpoints.
     35 * Prevent full-page caching for SapientSEO REST API endpoints (HTML rendering).
    4036 */
    4137add_action('template_redirect', 'sapientseo_template_redirect', 0);
     
    4743    }
    4844}
     45
     46/**
     47 * Prevent REST API response caching for SapientSEO endpoints.
     48 */
     49add_filter('rest_post_dispatch', function ($response, $server, $request) {
     50    if (strpos($request->get_route(), '/sapientseo/v1/') !== false) {
     51        if (is_object($response) && method_exists($response, 'header')) {
     52            $response->header('Cache-Control', 'no-cache, must-revalidate, max-age=0');
     53            $response->header('Pragma', 'no-cache');
     54            $response->header('Expires', '0');
     55        }
     56    }
     57    return $response;
     58}, 10, 3);
Note: See TracChangeset for help on using the changeset viewer.