PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 2.9.0
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v2.9.0
2.9.0 2.8.0 2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.1 2.1.0 2.0.2 2.0.1 2.0.0 1.32.0 1.31.0 1.30.0 1.29.0 1.28.0 1.27.0 1.26.0 1.25.0 trunk 1.0.0 1.0.1 1.0.2 All 50 releases
← All changes | includes/abilities/settings/class-update-author-archives-settings.php +32 -6 1.28.0 → 2.9.0 View file →
@@ -45,9 +45,9 @@
45 45 */
46 46 public function __construct() {
47 47 $this->id = 'thinkrank/update-author-archives-settings';
48 48 $this->label = __( 'Update ThinkRank Author Archives Settings', 'thinkrank' );
49 - $this->description = __( 'Update ThinkRank author archives settings: enable/index toggles, empty-archive visibility, and the SEO title/meta description templates.', 'thinkrank' );
49 + $this->description = __( 'Update ThinkRank author archives settings: enable/index toggles, empty-archive visibility, and the SEO title/meta description templates. Read the current values with get-author-archives-settings first; only the keys you pass are changed.', 'thinkrank' );
50 50 }
51 51
52 52 /**
53 53 * {@inheritDoc}
@@ -56,9 +56,16 @@
56 56 */
57 57 public function get_annotations() {
58 58 return [
59 59 'readonly' => false,
60 - 'destructive' => true,
60 + // Settings writes are recoverable: the matching get-* ability reads
61 + // the previous value, so nothing is lost that cannot be put back.
62 + // `destructive` is reserved for calls that lose data or reach
63 + // outside the site, and marking routine configuration with it made
64 + // MCP clients demand a human approval for every save — which users
65 + // reported as a permission bug, because the client's refusal reads
66 + // as "No approval received" (#675).
67 + 'destructive' => false,
61 68 'idempotent' => true,
62 69 'priority' => 2.0,
63 70 'openWorldHint' => false,
64 71 ];
@@ -121,21 +128,26 @@
121 128 [ 'status' => 400 ]
122 129 );
123 130 }
124 131
125 - $store = Settings::instance();
126 - $found = false;
132 + $store = Settings::instance();
133 + $found = false;
134 + $failed = [];
127 135
128 136 foreach ( self::BOOL_MAP as $alias => $storage_key ) {
129 137 if ( array_key_exists( $alias, $settings ) ) {
130 - $store->set( $storage_key, (bool) $settings[ $alias ] );
131 138 $found = true;
139 + if ( ! $store->set( $storage_key, (bool) $settings[ $alias ] ) ) {
140 + $failed[] = $alias;
141 + }
132 142 }
133 143 }
134 144 foreach ( self::STRING_MAP as $alias => $storage_key ) {
135 145 if ( array_key_exists( $alias, $settings ) ) {
136 - $store->set( $storage_key, sanitize_text_field( (string) $settings[ $alias ] ) );
137 146 $found = true;
147 + if ( ! $store->set( $storage_key, sanitize_text_field( (string) $settings[ $alias ] ) ) ) {
148 + $failed[] = $alias;
149 + }
138 150 }
139 151 }
140 152
141 153 if ( ! $found ) {
@@ -142,8 +154,22 @@
142 154 return new \WP_Error(
143 155 'thinkrank_no_valid_author_archives_setting_keys',
144 156 __( 'No valid author archives setting keys were provided.', 'thinkrank' ),
145 157 [ 'status' => 400 ]
158 + );
159 + }
160 +
161 + // A discarded set() return meant a failed write still answered
162 + // "settings updated"; surface it instead.
163 + if ( ! empty( $failed ) ) {
164 + return new \WP_Error(
165 + 'thinkrank_author_archives_settings_not_saved',
166 + sprintf(
167 + /* translators: %s is a comma-separated list of setting names that could not be saved. */
168 + __( 'Some author archives settings could not be saved: %s', 'thinkrank' ),
169 + implode( ', ', $failed )
170 + ),
171 + [ 'status' => 500 ]
146 172 );
147 173 }
148 174
149 175 return [