@@ -3608,22 +4229,24 @@ function noindex_seo_quick_edit_fields( $column_name, $post_type ) { // phpcs:ig
$('#the-list').on('click', '.editinline', function() {
var post_id = $(this).closest('tr').attr('id').replace('post-', '');
var $row = $('#post-' + post_id);
+ var $data = $row.find('.noindex-seo-override-data');
- // Get current values from the column (we'll use data attributes)
- var override = $row.find('.noindex-seo-override-data').data('override');
- var noindex = $row.find('.noindex-seo-override-data').data('noindex');
- var nofollow = $row.find('.noindex-seo-override-data').data('nofollow');
- var noarchive = $row.find('.noindex-seo-override-data').data('noarchive');
- var nosnippet = $row.find('.noindex-seo-override-data').data('nosnippet');
- var noimageindex = $row.find('.noindex-seo-override-data').data('noimageindex');
+ // Get current values from the column (data attributes)
+ var override = $data.data('override');
+ var booleans = ['noindex', 'nofollow', 'noarchive', 'nosnippet', 'noimageindex', 'notranslate'];
+ var values = ['max-snippet', 'max-image-preview', 'max-video-preview', 'unavailable_after'];
// Set checkbox values
$('#noindex-seo-quick-edit-override').prop('checked', override == 1);
- $('input[name="noindex_seo_noindex"]').prop('checked', noindex == 1);
- $('input[name="noindex_seo_nofollow"]').prop('checked', nofollow == 1);
- $('input[name="noindex_seo_noarchive"]').prop('checked', noarchive == 1);
- $('input[name="noindex_seo_nosnippet"]').prop('checked', nosnippet == 1);
- $('input[name="noindex_seo_noimageindex"]').prop('checked', noimageindex == 1);
+ $.each(booleans, function(i, name) {
+ $('input[name="noindex_seo_' + name + '"]').prop('checked', $data.data(name) == 1);
+ });
+
+ // Set value directives (empty = off; unavailable_after uses a T separator)
+ $.each(values, function(i, name) {
+ var value = String($data.data(name) || '').replace(' ', 'T');
+ $('[name="noindex_seo_' + name + '"]').val(value);
+ });
// Show/hide directives based on override
if (override == 1) {
@@ -3761,14 +4384,9 @@ function noindex_seo_handle_bulk_actions( $redirect_to, $action, array $post_ids
if ( 'noindex_seo_disable_override' === $action ) {
// Remove the override flag entirely and clear any directive meta so the
// post falls back to the global context settings.
- $directives = array( 'noindex', 'nofollow', 'noarchive', 'nosnippet', 'noimageindex' );
-
foreach ( $post_ids as $post_id ) {
delete_post_meta( $post_id, '_noindex_seo_override' );
-
- foreach ( $directives as $directive ) {
- delete_post_meta( $post_id, '_noindex_seo_' . $directive );
- }
+ noindex_seo_clear_post_directives( $post_id );
}
$redirect_to = add_query_arg( 'noindex_seo_bulk_disabled', count( $post_ids ), $redirect_to );
@@ -4296,27 +4914,59 @@ function noindex_seo_admin() {
$header_only_fields = array( 'attachment' );
$is_header_enabled = in_array( $option_config_method, array( 'header', 'both' ), true );
- // Define available directives with config.
+ // Define available directives with config. 'type' drives the grid cell:
+ // bool = checkbox, int = number input, preview = size select,
+ // datetime = datetime-local input. Empty value = off.
$directives_config = array(
- 'noindex' => array(
+ 'noindex' => array(
'label' => __( 'noindex', 'noindex-seo' ),
'desc' => __( 'Prevent search engines from indexing this page', 'noindex-seo' ),
+ 'type' => 'bool',
),
- 'nofollow' => array(
+ 'nofollow' => array(
'label' => __( 'nofollow', 'noindex-seo' ),
'desc' => __( 'Prevent search engines from following links on this page', 'noindex-seo' ),
+ 'type' => 'bool',
),
- 'noarchive' => array(
+ 'noarchive' => array(
'label' => __( 'noarchive', 'noindex-seo' ),
'desc' => __( 'Prevent search engines from showing a cached version', 'noindex-seo' ),
+ 'type' => 'bool',
),
- 'nosnippet' => array(
+ 'nosnippet' => array(
'label' => __( 'nosnippet', 'noindex-seo' ),
'desc' => __( 'Prevent search engines from showing text snippets', 'noindex-seo' ),
+ 'type' => 'bool',
),
- 'noimageindex' => array(
+ 'noimageindex' => array(
'label' => __( 'noimageindex', 'noindex-seo' ),
'desc' => __( 'Prevent search engines from indexing images', 'noindex-seo' ),
+ 'type' => 'bool',
+ ),
+ 'notranslate' => array(
+ 'label' => __( 'notranslate', 'noindex-seo' ),
+ 'desc' => __( 'Ask search engines not to translate this page', 'noindex-seo' ),
+ 'type' => 'bool',
+ ),
+ 'max-snippet' => array(
+ 'label' => __( 'max-snippet', 'noindex-seo' ),
+ 'desc' => __( 'Maximum snippet length in characters (-1 = no limit)', 'noindex-seo' ),
+ 'type' => 'int',
+ ),
+ 'max-image-preview' => array(
+ 'label' => __( 'max-image-preview', 'noindex-seo' ),
+ 'desc' => __( 'Maximum image preview size', 'noindex-seo' ),
+ 'type' => 'preview',
+ ),
+ 'max-video-preview' => array(
+ 'label' => __( 'max-video-preview', 'noindex-seo' ),
+ 'desc' => __( 'Maximum video preview seconds (-1 = no limit)', 'noindex-seo' ),
+ 'type' => 'int',
+ ),
+ 'unavailable_after' => array(
+ 'label' => __( 'unavailable_after', 'noindex-seo' ),
+ 'desc' => __( 'Stop indexing this page after this date and time', 'noindex-seo' ),
+ 'type' => 'datetime',
),
);
?>
@@ -4614,6 +5264,7 @@ function noindex_seo_admin() {
$directive_option_key = $directive . '_seo_' . $field_id;
$directive_value = noindex_seo_get_setting( $field_id, $directive );
?>
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ '',
+ 'value' => '',
+ ),
+ ); // One empty row for the first rule.
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/readme.txt b/readme.txt
index d2ead4a..dd2e8a2 100644
--- a/readme.txt
+++ b/readme.txt
@@ -3,9 +3,9 @@ Contributors: robotstxt, javiercasares
Tags: seo, noindex, nofollow, noarchive, robots
Requires at least: 7.0
Tested up to: 7.2
-Stable tag: 3.5.0
+Stable tag: 3.6.0
Requires PHP: 8.3
-Version: 3.5.0
+Version: 3.6.0
License: GPL-3.0-or-later
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
@@ -13,9 +13,9 @@ Control search engine indexing with robots directives using HTML meta tags or HT
== Description ==
-Fine-grained control over how search engines index and display your WordPress content. Apply 5 independent robots directives to 25 different page contexts with flexible implementation methods.
+Fine-grained control over how search engines index and display your WordPress content. Apply 10 robots directives to 25 different page contexts with flexible implementation methods.
-**5 Robots Directives:**
+**5 Boolean Robots Directives:**
* **noindex**: Prevent search engines from indexing the page
* **nofollow**: Prevent search engines from following links on the page
@@ -23,6 +23,16 @@ Fine-grained control over how search engines index and display your WordPress co
* **nosnippet**: Prevent search engines from showing text snippets in results
* **noimageindex**: Prevent search engines from indexing images on the page
+**5 Value Robots Directives (3.6.0):**
+
+* **notranslate**: Ask search engines not to translate the page
+* **max-snippet**: Limit the text snippet length in characters (-1 = no limit)
+* **max-image-preview**: Limit the image preview size (none / standard / large)
+* **max-video-preview**: Limit the video preview length in seconds (-1 = no limit)
+* **unavailable_after**: Stop indexing the page after a date and time
+
+**Conditional rules (3.6.0):** automatically apply noindex to any post whose custom field (for example an ACF field) exactly matches a value you define.
+
**Implementation Methods:**
* HTML Meta Tags: Traditional method, easy to verify in page source (default)
@@ -110,7 +120,7 @@ Important note: if you have any doubt about any of the following items it is bes
The plugin ships a `wp noindex-seo` command namespace (WP-CLI 2.x required):
* `wp noindex-seo list [--only=] [--format=]` — lists every context × directive pair and its on/off status (table, csv, json or yaml).
-* `wp noindex-seo set [...]` — enables directives on a context (default: all five). Example: `wp noindex-seo set search noindex noarchive`.
+* `wp noindex-seo set [...]` — enables directives on a context (default: all six boolean directives). Boolean directives go by name; value directives as `name=value`: `wp noindex-seo set search noindex noarchive`, `wp noindex-seo set archive max-snippet=-1 max-image-preview=large`.
* `wp noindex-seo unset [...]` — disables directives on a context.
* `wp noindex-seo export []` — prints the settings payload as JSON to STDOUT, or writes it to a file.
* `wp noindex-seo import [--dry-run]` — restores settings from an export; `--dry-run` reports how many values would change without saving.
@@ -127,10 +137,18 @@ The settings page includes an "Export settings" button that downloads the curren
The plugin exposes two read-only endpoints under `/wp-json/noindex-seo/v1/` so headless consumers can read the configuration:
* `GET /settings`: returns the consolidated settings array (contexts and directives plus config). Requires an authenticated user with the `manage_options` capability.
-* `GET /effective?post_id=123`: returns the list of active directives for a specific post, computed with the same precedence used on the front-end (per-post override, then per-post-type default, then the built-in context). Public only for published, non-password-protected posts; everything else requires `edit_post` capabilities.
+* `GET /effective?post_id=123`: returns the list of active directives for a specific post, computed with the same precedence used on the front-end (per-post override, then conditional rules, then per-post-type default, then the built-in context). Value directives return as `name:value` tokens (e.g. `max-snippet:-1`); `source` is `post_meta`, `auto_rule` (a conditional rule matched) or `global_setting`. Public only for published, non-password-protected posts; everything else requires `edit_post` capabilities.
On WordPress versions with XML sitemaps (5.5+), URLs that are noindexed are automatically excluded from the core sitemaps.
+== Multisite ==
+
+The plugin is designed **per site** and works on WordPress Multisite when activated on each site individually (or via the Network Admin's "Add Plugin" per-site flow):
+
+* Directives are site-content concerns, so every site keeps its own independent settings, per-post overrides, per-term overrides and conditional rules (stored per site, no network-wide storage).
+* There is no network-admin settings page and no `Network: true` header by design: activating the plugin network-wide would apply each site's own settings anyway (each site reads its own options), so per-site activation is the intended and documented mode.
+* To roll out the same configuration across sites, use the built-in export/import (Tools tab, JSON) or `wp noindex-seo export` / `wp noindex-seo import` per site — for example with WP-CLI's `--url` switch.
+
== Installation ==
= Automatic download =
@@ -162,6 +180,10 @@ No. By default all plugin data is preserved on uninstall. If you want a complete
== Changelog ==
+= 3.6.0 =
+
+Feature release: 5 modern robots directives (notranslate, max-snippet, max-image-preview, max-video-preview, unavailable_after) available on every surface — global contexts, per-post and per-term overrides, Quick Edit, the block editor sidebar, REST and WP-CLI (name=value tokens); conditional auto-noindex rules that apply noindex when a custom field (e.g. an ACF field) exactly matches a value (matched posts also drop out of the XML sitemap); Multisite behavior documented (per-site by design, with export/import-based rollout).
+
= 3.5.0 =
WooCommerce special-page contexts: dedicated robots directives for the Cart, Checkout and My Account pages (detected through the page-ID options, no WooCommerce code needed), recommended by default and mirrored across the front-end, the REST /effective endpoint and the core XML sitemaps. Compatibility window updated to WordPress 7.0 - 7.2 and PHP 8.3 - 8.6 (tested on WordPress 7.2-beta3 and PHP 8.6.0RC3). The five directive icons now render as SVG through the WordPress Icons API on WP 7.2+ (legacy emoji fallback on WP 7.0 - 7.1), matching the SVG direction of the WordPress 7.2 admin. Fixed the `wp noindex-seo list` command, which fatalled on real WP-CLI installs (its `--context` filter collided with WP-CLI 2.11+'s reserved global flag, now `--only`, and the output call used a nonexistent API).
@@ -170,10 +192,6 @@ WooCommerce special-page contexts: dedicated robots directives for the Cart, Che
WP-CLI support: a `wp noindex-seo` command namespace with `list`, `set`, `unset`, `export`, `import` and bulk per-post `override` — automation-friendly and scaling past the ~200-post ceiling of the bulk UI.
-= 3.3.0 =
-
-Settings page reorganized with the native WordPress tab navigation (General / SEO Settings / Import-Export, no custom tab code) and titled sections; saving is tab-scoped so hidden tabs never reset each other's values.
-
= Previous versions =
If you want to see the full changelog, visit the [noindex SEO plugin page](https://www.robotstxt.software/plugins/noindex-seo/).
@@ -194,6 +212,6 @@ This plugin adheres to the following security measures and review protocols for
== Vulnerabilities ==
-* No vulnerabilities have been published up to version 3.5.0.
+* No vulnerabilities have been published up to version 3.6.0.
Found a security vulnerability? Please report it to us privately at the [noindex SEO GitHub repository](https://github.com/javiercasares/noindex-seo/security/advisories/new).
diff --git a/uninstall.php b/uninstall.php
index a73ff35..44abb99 100644
--- a/uninstall.php
+++ b/uninstall.php
@@ -137,7 +137,8 @@ $wpdb->query(
)
);
-// Clean up post meta (granular control).
+// Clean up post meta (granular control). The 3.6.0 value directives store
+// their per-post values under the same prefix.
$noindex_seo_meta_keys = array(
'_noindex_seo_override',
'_noindex_seo_noindex',
@@ -145,6 +146,11 @@ $noindex_seo_meta_keys = array(
'_noindex_seo_noarchive',
'_noindex_seo_nosnippet',
'_noindex_seo_noimageindex',
+ '_noindex_seo_notranslate',
+ '_noindex_seo_max-snippet',
+ '_noindex_seo_max-image-preview',
+ '_noindex_seo_max-video-preview',
+ '_noindex_seo_unavailable_after',
);
foreach ( $noindex_seo_meta_keys as $noindex_seo_meta_key ) {