??????????????
??????????????
??????????????
??????????????
Warning : Undefined variable $auth in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
Warning : Trying to access array offset on value of type null in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
??????????????
??????????????
??????????????
??????????????
File Manager
✏️ Edit File: /home/mklsvubc/sendmaxagency.com/wp-content/plugins/surerank/inc/functions/modified-date-lock.php
⬅ Kembali
<?php
/**
* Modified Date Lock Handler.
*
* @package SureRank\Inc\Functions
* @since 1.7.5
*/
namespace SureRank\Inc\Functions;
use SureRank\Inc\Traits\Get_Instance;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Enables filter-based control over preserving WordPress modified timestamps.
*/
class Modified_Date_Lock {
use Get_Instance;
/**
* Constructor.
*/
public function __construct() {
add_filter( 'wp_insert_post_data', [ $this, 'maybe_preserve_modified_date' ], 10, 4 );
}
/**
* Preserve post_modified values on updates when the SureRank filter opts in.
*
* @param array<string, mixed> $data Sanitized post data to be inserted.
* @param array<string, mixed> $postarr Raw and sanitized post data.
* @param array<string, mixed> $unsanitized_postarr Original unchanged post data.
* @param bool $update Whether this is an existing post being updated.
* @return array<string, mixed>
*/
public function maybe_preserve_modified_date( array $data, array $postarr, array $unsanitized_postarr, bool $update ): array {
if ( ! $update ) {
return $data;
}
$post_id = isset( $postarr['ID'] ) ? (int) $postarr['ID'] : 0;
if ( $post_id <= 0 || wp_is_post_revision( $post_id ) || wp_is_post_autosave( $post_id ) ) {
return $data;
}
$post = get_post( $post_id );
if ( ! $post instanceof \WP_Post ) {
return $data;
}
/**
* Allow developers to freeze modified timestamps for a post update.
*
* Return true to preserve current database values for `post_modified`
* and `post_modified_gmt` during this update.
*
* @since 1.7.5
*
* @param bool $freeze Whether to freeze modified timestamps. Default false.
* @param int $post_id Post ID being updated.
* @param \WP_Post $post Current post object from database (pre-update).
* @param array<string, mixed> $data Outgoing sanitized post data.
* @param array<string, mixed> $postarr Post data array.
* @param array<string, mixed> $unsanitized_postarr Original unchanged post data.
*/
$freeze_modified_date = (bool) apply_filters( 'surerank_freeze_modified_date', false, $post_id, $post, $data, $postarr, $unsanitized_postarr );
if ( ! $freeze_modified_date ) {
return $data;
}
$data['post_modified'] = $post->post_modified;
$data['post_modified_gmt'] = $post->post_modified_gmt;
return $data;
}
}
Nama
Tipe
Ukuran
Diubah
Aksi
🐘 api-utils.php
php
6.6 KB
2026-06-18 16:45
🐘 cache.php
php
18.6 KB
2026-06-18 16:45
🐘 compat.php
php
7.5 KB
2026-06-18 16:45
🐘 cron.php
php
3.3 KB
2026-06-18 16:45
🐘 defaults.php
php
14.2 KB
2026-06-18 16:45
🐘 get.php
php
6.8 KB
2026-06-18 16:45
🐘 helper.php
php
22.1 KB
2026-06-18 16:45
🐘 modified-date-lock.php
php
2.5 KB
2026-06-18 16:45
🐘 requests.php
php
1.9 KB
2026-06-18 16:45
🐘 rest-observation.php
php
2.8 KB
2026-06-18 16:45
🐘 sanitize.php
php
5 KB
2026-06-18 16:45
🐘 send-json.php
php
1.3 KB
2026-06-18 16:45
🐘 settings.php
php
24.2 KB
2026-06-18 16:45
🐘 update.php
php
4.2 KB
2026-06-18 16:45
🐘 utils.php
php
2.5 KB
2026-06-18 16:45
🐘 validate.php
php
2.3 KB
2026-06-18 16:45
🐘 variables.php
php
3.7 KB
2026-06-18 16:45