fix: invalidate restored permalink option caches

This commit is contained in:
chrnx committed 2026-08-12 14:29:50 -05:00
1 parent 05dfe83a49
commit c95d8ffa9a
2 files changed
+11 -1

No files matched your search

+8
View File
@@ -47,6 +47,14 @@ class FixtureEnvironmentTest extends WP_UnitTestCase {
$this->assertNull( $restored );
}
$this->assertSame( $outer_exists ? $outer_value : '', $wp_rewrite->permalink_structure );
if ( ! $outer_exists ) {
$missing_sentinel = 'chrnx-missing-permalink';
$this->assertSame( $missing_sentinel, get_option( 'permalink_structure', $missing_sentinel ) );
$this->assertTrue( update_option( 'permalink_structure', '/reinserted/%post_id%/' ) );
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- A subsequent Options API insert must persist after exact raw absence is restored.
$reinserted = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM {$wpdb->options} WHERE option_name = %s", 'permalink_structure' ) );
$this->assertSame( '/reinserted/%post_id%/', $reinserted );
}
}
/** Snapshot/restore preserves exact options, unrelated stickies, and owned status. */