diff --git a/assets/css/admin.css b/assets/css/admin.css index 8910d4a..58c776b 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -1,7 +1,9 @@ /** - * noindex SEO - Admin Panel Styles - * Version: 2.0.0 - * Modern, visual admin interface + * noindex SEO - Admin styles + * + * Follows the WordPress admin color scheme via the --wp-admin-theme-color + * custom property (with the core default as fallback) and the core admin + * status palette. Uses logical properties so RTL works out of the box. */ /* =========================== @@ -12,63 +14,19 @@ margin: 20px 0; } -/* Header styles removed - using WordPress default styles */ - -/* =========================== - Tabs Navigation - =========================== */ -.noindex-seo-tabs { - display: flex; - gap: 10px; - margin-bottom: 30px; - border-bottom: 2px solid #e5e7eb; - flex-wrap: wrap; +/* Tab navigation uses the native WordPress nav-tab classes. */ +.noindex-seo-admin-wrap .nav-tab-wrapper { + margin-bottom: 20px; } -.noindex-seo-tab { - padding: 12px 24px; - background: transparent; - border: none; - color: #6b7280; - font-size: 15px; - font-weight: 500; - cursor: pointer; - border-bottom: 3px solid transparent; - transition: all 0.3s ease; - position: relative; - top: 2px; +/* Section titles inside a tab panel. Vertical separation between + sections comes from the content blocks' own bottom margins. */ +.noindex-seo-section-title { + margin: 0 0 12px 0; } -.noindex-seo-tab:hover { - color: #667eea; -} - -.noindex-seo-tab.active { - color: #667eea; - border-bottom-color: #667eea; -} - -/* =========================== - Tab Content - =========================== */ -.noindex-seo-tab-content { - display: none; -} - -.noindex-seo-tab-content.active { - display: block; - animation: fadeIn 0.3s ease; -} - -@keyframes fadeIn { - from { - opacity: 0; - transform: translateY(10px); - } - to { - opacity: 1; - transform: translateY(0); - } +.noindex-seo-section-title + .description { + margin: 0 0 12px 0; } /* =========================== @@ -80,13 +38,13 @@ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); margin-bottom: 20px; overflow: hidden; - border: 1px solid #e5e7eb; + border: 1px solid #c3c4c7; } .noindex-seo-card-header { padding: 20px 24px; - background: #f9fafb; - border-bottom: 1px solid #e5e7eb; + background: #f6f7f7; + border-bottom: 1px solid #c3c4c7; display: flex; align-items: center; justify-content: space-between; @@ -95,28 +53,28 @@ } .noindex-seo-card-header:hover { - background: #f3f4f6; + background: #f0f0f1; } .noindex-seo-card-header h3 { margin: 0; font-size: 16px; font-weight: 600; - color: #111827; + color: #2c3338; display: flex; align-items: center; gap: 10px; } .noindex-seo-card-header .dashicons { - color: #667eea; + color: var(--wp-admin-theme-color, #2271b1); font-size: 20px; width: 20px; height: 20px; } .noindex-seo-card-toggle { - color: #9ca3af; + color: #8c8f94; transition: transform 0.3s ease; } @@ -124,6 +82,10 @@ transform: rotate(-90deg); } +[dir="rtl"] .noindex-seo-card.collapsed .noindex-seo-card-toggle { + transform: rotate(90deg); +} + .noindex-seo-card-body { padding: 24px; display: grid; @@ -140,10 +102,10 @@ =========================== */ .noindex-seo-option { padding: 24px; - background: #f9fafb; + background: #f6f7f7; border-radius: 8px; - border: 1px solid #e5e7eb; - transition: all 0.2s ease; + border: 1px solid #c3c4c7; + transition: border-color 0.2s ease; margin-bottom: 20px; } @@ -152,15 +114,15 @@ } .noindex-seo-option:hover { - background: #f3f4f6; - border-color: #d1d5db; + background: #f0f0f1; + border-color: #8c8f94; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); } .noindex-seo-option-header { margin-bottom: 18px; padding-bottom: 14px; - border-bottom: 1px solid #e5e7eb; + border-bottom: 1px solid #c3c4c7; } .noindex-seo-option-title { @@ -169,7 +131,7 @@ gap: 8px; margin-bottom: 6px; font-size: 15px; - color: #111827; + color: #2c3338; } .noindex-seo-option-title strong { @@ -177,32 +139,12 @@ } .noindex-seo-option-description { - color: #6b7280; + color: #646970; font-size: 13px; line-height: 1.5; margin: 0; } -.noindex-seo-view-link { - color: #667eea; - text-decoration: none; - display: inline-flex; - align-items: center; - gap: 4px; - font-size: 13px; - transition: color 0.2s ease; -} - -.noindex-seo-view-link:hover { - color: #5568d3; -} - -.noindex-seo-view-link .dashicons { - width: 14px; - height: 14px; - font-size: 14px; -} - /* =========================== Directives Checkboxes =========================== */ @@ -219,18 +161,18 @@ gap: 10px; padding: 10px 14px; background: #fff; - border: 2px solid #e5e7eb; + border: 2px solid #c3c4c7; border-radius: 6px; cursor: pointer; - transition: all 0.2s ease; + transition: border-color 0.2s ease; user-select: none; font-size: 13px; font-weight: 500; - color: #374151; + color: #3c434a; } .noindex-seo-directive-checkbox:hover { - border-color: #d1d5db; + border-color: #8c8f94; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); } @@ -239,21 +181,16 @@ width: 18px; height: 18px; cursor: pointer; - accent-color: #667eea; flex-shrink: 0; } -.noindex-seo-directive-checkbox input[type="checkbox"]:checked { - background-color: #667eea; -} - .noindex-seo-directive-checkbox:has(input:checked) { - border-color: #667eea; - background-color: #eff6ff; + border-color: var(--wp-admin-theme-color, #2271b1); + background-color: #f0f6fc; } .noindex-seo-directive-checkbox:has(input:checked) .directive-label { - color: #667eea; + color: var(--wp-admin-theme-color, #2271b1); font-weight: 600; } @@ -265,6 +202,22 @@ text-align: center; } +/* SVG directive icons (WP 7.1+ via the core Icons API; emoji fallback + inherits the surrounding text metrics instead). */ +svg.noindex-seo-directive-icon { + vertical-align: text-bottom; + flex-shrink: 0; +} + +.directive-icon .noindex-seo-directive-icon { + display: block; + margin: 0 auto; +} + +.noindex-seo-badge-item .noindex-seo-directive-icon { + margin-inline-end: 2px; +} + .directive-label { font-family: 'Courier New', monospace; font-size: 13px; @@ -273,21 +226,22 @@ } .directive-description { - color: #6b7280; + color: #646970; font-size: 12px; font-weight: 400; - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; + font-family: inherit; flex: 2; } /* =========================== - Toggle Switch (Modern) + Toggle Switch =========================== */ .noindex-seo-switch { position: relative; display: inline-block; width: 48px; height: 26px; + flex-shrink: 0; } .noindex-seo-switch input { @@ -303,7 +257,7 @@ left: 0; right: 0; bottom: 0; - background-color: #cbd5e1; + background-color: #8c8f94; transition: 0.3s; border-radius: 34px; } @@ -315,24 +269,34 @@ width: 20px; left: 3px; bottom: 3px; - background-color: white; + background-color: #fff; transition: 0.3s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); } input:checked + .noindex-seo-slider { - background-color: #667eea; + background-color: var(--wp-admin-theme-color, #2271b1); } -input:focus + .noindex-seo-slider { - box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2); +input:focus-visible + .noindex-seo-slider { + outline: 2px solid var(--wp-admin-theme-color, #2271b1); + outline-offset: 2px; } input:checked + .noindex-seo-slider:before { transform: translateX(22px); } +[dir="rtl"] .noindex-seo-slider:before { + left: auto; + right: 3px; +} + +[dir="rtl"] input:checked + .noindex-seo-slider:before { + transform: translateX(-22px); +} + /* =========================== Badges & Indicators =========================== */ @@ -348,18 +312,18 @@ input:checked + .noindex-seo-slider:before { } .noindex-seo-badge.recommended { - background: #dcfce7; - color: #166534; + background: #edfaef; + color: #076b32; } .noindex-seo-badge.not-recommended { - background: #fee2e2; - color: #991b1b; + background: #fcf0f1; + color: #b32d2e; } .noindex-seo-badge.neutral { - background: #e0e7ff; - color: #3730a3; + background: #f0f0f1; + color: #3c434a; } .noindex-seo-badge .dashicons { @@ -368,12 +332,19 @@ input:checked + .noindex-seo-slider:before { height: 14px; } +/* =========================== + "Apply Recommended Defaults" form + =========================== */ +.noindex-seo-apply-form { + margin: 0 0 20px 0; +} + /* =========================== General Config Section =========================== */ .noindex-seo-general-config { - background: #fffbeb; - border: 1px solid #fcd34d; + background: #fff; + border: 1px solid #c3c4c7; border-radius: 8px; padding: 20px; margin-bottom: 30px; @@ -382,14 +353,14 @@ input:checked + .noindex-seo-slider:before { .noindex-seo-general-config h2 { margin: 0 0 16px 0; font-size: 18px; - color: #92400e; + color: #2c3338; display: flex; align-items: center; gap: 8px; } .noindex-seo-general-config .dashicons { - color: #f59e0b; + color: var(--wp-admin-theme-color, #2271b1); } .noindex-seo-config-option { @@ -398,18 +369,38 @@ input:checked + .noindex-seo-slider:before { gap: 12px; } +.noindex-seo-config-option + .noindex-seo-config-option { + margin-top: 20px; +} + .noindex-seo-config-option label { - color: #78350f; - font-weight: 500; cursor: pointer; } +.noindex-seo-config-body { + flex: 1; +} + +.noindex-seo-config-label { + display: block; + font-weight: 600; + margin-bottom: 8px; +} + +.noindex-seo-config-label-danger { + color: #b32d2e; +} + +.noindex-seo-config-select { + max-width: 400px; +} + /* =========================== Alert / Notice =========================== */ .noindex-seo-alert { - background: #fef3c7; - border-left: 4px solid #f59e0b; + background: #fcf9e8; + border-inline-start: 4px solid #dba617; padding: 16px 20px; margin-bottom: 24px; border-radius: 4px; @@ -419,22 +410,17 @@ input:checked + .noindex-seo-slider:before { } .noindex-seo-alert .dashicons { - color: #d97706; + color: #dba617; flex-shrink: 0; margin-top: 2px; } .noindex-seo-alert p { margin: 0; - color: #92400e; + color: #3c434a; line-height: 1.6; } -/* =========================== - Submit Button - =========================== */ -/* Submit button styles removed - using WordPress default submit_button() */ - /* =========================== Search/Filter =========================== */ @@ -445,17 +431,12 @@ input:checked + .noindex-seo-slider:before { .noindex-seo-search input { width: 100%; max-width: 400px; - padding: 10px 16px; - border: 1px solid #d1d5db; - border-radius: 6px; - font-size: 14px; - transition: all 0.2s ease; } .noindex-seo-search input:focus { outline: none; - border-color: #667eea; - box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1); + border-color: var(--wp-admin-theme-color, #2271b1); + box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1); } /* =========================== @@ -469,23 +450,23 @@ input:checked + .noindex-seo-slider:before { } .noindex-seo-stat-card { - background: white; + background: #fff; padding: 20px; border-radius: 8px; - border: 1px solid #e5e7eb; + border: 1px solid #c3c4c7; text-align: center; } .noindex-seo-stat-number { font-size: 32px; font-weight: 700; - color: #667eea; + color: var(--wp-admin-theme-color, #2271b1); margin: 0; line-height: 1; } .noindex-seo-stat-label { - color: #6b7280; + color: #646970; font-size: 13px; margin-top: 8px; font-weight: 500; @@ -495,65 +476,42 @@ input:checked + .noindex-seo-slider:before { View Link =========================== */ .noindex-seo-view-link { - color: #667eea; + color: var(--wp-admin-theme-color, #2271b1); text-decoration: none; - font-size: 13px; - font-weight: 500; display: inline-flex; align-items: center; gap: 4px; + font-size: 13px; + font-weight: 500; transition: color 0.2s ease; } .noindex-seo-view-link:hover { - color: #764ba2; text-decoration: underline; } .noindex-seo-view-link .dashicons { - font-size: 16px; - width: 16px; - height: 16px; -} - -/* =========================== - Responsive Design - =========================== */ -@media (max-width: 782px) { - .noindex-seo-card-body { - grid-template-columns: 1fr; - } - - .noindex-seo-tabs { - overflow-x: auto; - -webkit-overflow-scrolling: touch; - } - - .noindex-seo-tab { - white-space: nowrap; - } - - .noindex-seo-stats { - grid-template-columns: 1fr; - } + font-size: 14px; + width: 14px; + height: 14px; } /* =========================== Success Message =========================== */ .noindex-seo-success { - background: #dcfce7; - border-left: 4px solid #16a34a; + background: #edfaef; + border-inline-start: 4px solid #00a32a; padding: 16px 20px; margin: 20px 0; border-radius: 4px; display: flex; align-items: center; gap: 12px; - animation: slideDown 0.3s ease; + animation: noindexSeoSlideDown 0.3s ease; } -@keyframes slideDown { +@keyframes noindexSeoSlideDown { from { opacity: 0; transform: translateY(-10px); @@ -565,13 +523,13 @@ input:checked + .noindex-seo-slider:before { } .noindex-seo-success .dashicons { - color: #16a34a; + color: #00a32a; flex-shrink: 0; } .noindex-seo-success p { margin: 0; - color: #166534; + color: #076b32; font-weight: 500; } @@ -585,14 +543,14 @@ input:checked + .noindex-seo-slider:before { } .noindex-seo-tooltip .dashicons { - color: #9ca3af; + color: #8c8f94; font-size: 16px; width: 16px; height: 16px; } .noindex-seo-tooltip:hover .dashicons { - color: #667eea; + color: var(--wp-admin-theme-color, #2271b1); } /* =========================== @@ -602,7 +560,7 @@ input:checked + .noindex-seo-slider:before { opacity: 0.6; cursor: not-allowed; position: relative; - background: #f9fafb; + background: #f6f7f7; } .noindex-seo-option.disabled::before { @@ -621,17 +579,158 @@ input:checked + .noindex-seo-slider:before { } .noindex-seo-option.disabled .noindex-seo-option-title { - color: #9ca3af; + color: #8c8f94; } .noindex-seo-option.disabled .noindex-seo-option-description { - color: #d1d5db; + color: #a7aaad; +} + +/* =========================== + Post meta box (classic editor) + =========================== */ +.noindex-seo-meta-override { + margin-top: 0; +} + +.noindex-seo-meta-note { + margin: 8px 0 12px 0; + font-size: 12px; + line-height: 1.4; +} + +.noindex-seo-directive-list { + border-top: 1px solid #dcdcde; + padding-top: 12px; + margin-bottom: 12px; +} + +.noindex-seo-directive-row { + display: flex; + align-items: center; + gap: 8px; + margin-bottom: 8px; +} + +.noindex-seo-reference { + margin-top: 12px; + padding: 10px; + background: #f6f7f7; + border: 1px solid #c3c4c7; + border-radius: 4px; +} + +.noindex-seo-reference-title { + margin: 0 0 8px 0; + font-size: 11px; + font-weight: 600; + color: #3c434a; +} + +.noindex-seo-ref { + margin: 0 0 4px 0; + padding: 6px; + font-size: 11px; +} + +.noindex-seo-ref:last-child { + margin-bottom: 0; +} + +.noindex-seo-ref code { + font-size: 10px; +} + +.noindex-seo-ref-override { + background: #f0f6fc; + border-inline-start: 3px solid #72aee6; +} + +.noindex-seo-ref-none { + background: #fcf9e8; + border-inline-start: 3px solid #dba617; +} + +.noindex-seo-ref-global { + background: #fff; + border-inline-start: 3px solid #c3c4c7; +} + +.noindex-seo-ref-ok { + background: #edfaef; + border-inline-start: 3px solid #00a32a; + color: #076b32; +} + +/* =========================== + Term edit panel + =========================== */ +.noindex-seo-term-directives { + margin-top: 8px; +} + +.noindex-seo-term-directive { + display: inline-block; + margin-inline-end: 12px; +} + +/* =========================== + List-table columns (posts and terms) + =========================== */ +.noindex-seo-col-empty { + color: #8c8f94; +} + +.noindex-seo-badges { + display: flex; + flex-wrap: wrap; + gap: 4px; +} + +.noindex-seo-badge-item { + display: inline-block; + padding: 2px 6px; + background: #f0f6fc; + border: 1px solid var(--wp-admin-theme-color, #2271b1); + border-radius: 3px; + font-size: 11px; + line-height: 1.2; +} + +/* =========================== + Quick Edit + =========================== */ +.noindex-seo-quick-edit-list { + padding: 5px 0; +} + +.noindex-seo-quick-edit-label { + display: block; + margin-bottom: 6px; +} + +.noindex-seo-quick-edit-nested { + margin-inline-start: 20px; + margin-top: 8px; +} + +.noindex-seo-quick-edit-option { + display: block; + margin-bottom: 4px; } /* =========================== Responsive Design =========================== */ -@media screen and (max-width: 782px) { +@media (max-width: 782px) { + .noindex-seo-card-body { + grid-template-columns: 1fr; + } + + .noindex-seo-stats { + grid-template-columns: 1fr; + } + .noindex-seo-directive-checkbox { flex-direction: row; flex-wrap: wrap; @@ -639,7 +738,7 @@ input:checked + .noindex-seo-slider:before { .directive-description { flex-basis: 100%; - margin-left: 52px; + margin-inline-start: 52px; margin-top: 4px; font-size: 11px; } @@ -662,3 +761,122 @@ input:checked + .noindex-seo-slider:before { display: none; } } + +/* =========================== + Value directives & rules (3.6.0) + =========================== */ + +/* Settings-grid value cells: number, select and datetime inputs. */ +.noindex-seo-directive-value input[type="number"], +.noindex-seo-directive-value input[type="datetime-local"] { + width: 130px; + max-width: 100%; +} + +.noindex-seo-directive-value select { + width: 130px; + max-width: 100%; +} + +.noindex-seo-directive-value .directive-label { + font-family: 'Courier New', monospace; + font-size: 13px; +} + +/* Meta-box and term-panel value rows. */ +.noindex-seo-value-list { + margin-top: 10px; + padding-top: 8px; + border-top: 1px solid #c3c4c7; +} + +.noindex-seo-values-title { + margin: 0 0 6px; +} + +.noindex-seo-value-row input[type="number"], +.noindex-seo-value-row input[type="datetime-local"] { + width: 150px; + max-width: 100%; +} + +.noindex-seo-value-row select { + width: 110px; + max-width: 100%; +} + +.noindex-seo-term-directive-value { + display: inline-flex; + align-items: center; + gap: 6px; + margin-top: 6px; +} + +.noindex-seo-term-directive-value input[type="number"], +.noindex-seo-term-directive-value input[type="datetime-local"] { + width: 150px; + max-width: 100%; +} + +/* Quick Edit value rows. */ +.noindex-seo-quick-edit-value input[type="number"], +.noindex-seo-quick-edit-value input[type="datetime-local"] { + width: 130px; + max-width: 100%; +} + +.noindex-seo-quick-edit-value select { + width: 110px; + max-width: 100%; +} + +/* Conditional-rules table. */ +.noindex-seo-rules-table { + padding: 8px 0; +} + +.noindex-seo-rule-head, +.noindex-seo-rule-row { + display: grid; + grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) 44px; + gap: 8px; + align-items: center; + margin-bottom: 8px; +} + +.noindex-seo-rule-head { + font-weight: 600; +} + +.noindex-seo-rule-remove .dashicons { + margin-top: 4px; + line-height: 1; +} + +/* =========================== + Robots.txt management (3.7.0) + =========================== */ + +.noindex-seo-robotstxt-table { + margin-top: 12px; +} + +.noindex-seo-robotstxt-table input[type="text"] { + width: 100%; + max-width: 320px; +} + +.noindex-seo-robotstxt-preview { + max-width: 480px; + padding: 12px; + background: #fff; + border: 1px solid #c3c4c7; + border-radius: 3px; + overflow: auto; +} + +.noindex-seo-robotstxt-preview code { + font-family: Consolas, Monaco, monospace; + font-size: 12px; + white-space: pre; +} diff --git a/assets/js/admin.js b/assets/js/admin.js index 72d7c9a..dc9e784 100644 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -13,43 +13,86 @@ * Initialize the admin panel */ function init() { - initTabs(); initCollapsibleCards(); initSearch(); initStats(); initTooltips(); - initMethodDependentFields(); + initRules(); } /** - * Initialize tabs functionality + * Initialize the rule tables (conditional rules + robots.txt): + * add / remove rows, and the robots.txt preset buttons. */ - function initTabs() { - $( '.noindex-seo-tab' ).on( + function initRules() { + // Add rule: clone the last row of the target container and clear it. + $( '.noindex-seo-rule-add' ).on( 'click', - function (e) { - e.preventDefault(); + function () { + const target = $( this ).data( 'target' ) || '.noindex-seo-rule-rows'; + const $rows = $( target ).first(); + const max = parseInt( $rows.data( 'max-rules' ) || 20, 10 ); - const tabId = $( this ).data( 'tab' ); + if ( $rows.find( '.noindex-seo-rule-row' ).length >= max ) { + return; + } - // Update active tab. - $( '.noindex-seo-tab' ).removeClass( 'active' ); - $( this ).addClass( 'active' ); - - // Update active content. - $( '.noindex-seo-tab-content' ).removeClass( 'active' ); - $( '#' + tabId ).addClass( 'active' ); - - // Save last active tab to localStorage. - localStorage.setItem( 'noindexSeoActiveTab', tabId ); + const $clone = $rows.find( '.noindex-seo-rule-row' ).last().clone(); + $clone.find( 'input[type="text"], input[type="number"], input[type="datetime-local"]' ).val( '' ); + $rows.append( $clone ); } ); - // Restore last active tab. - const lastTab = localStorage.getItem( 'noindexSeoActiveTab' ); - if (lastTab && $( '#' + lastTab ).length) { - $( '.noindex-seo-tab[data-tab="' + lastTab + '"]' ).click(); - } + // Remove rule: drop the row, or clear it when it is the last one left. + $( document ).on( + 'click', + '.noindex-seo-rule-remove', + function () { + const $row = $( this ).closest( '.noindex-seo-rule-row' ); + const $rows = $( this ).closest( '.noindex-seo-rule-rows' ); + + if ( $rows.find( '.noindex-seo-rule-row' ).length > 1 ) { + $row.remove(); + } else { + $row.find( 'input[type="text"]' ).val( '' ); + } + } + ); + + // Robots.txt presets: append one blocked row per bot of the preset + // (skipping agents that already have a rule). + $( '.noindex-seo-robotstxt-preset' ).on( + 'click', + function () { + const preset = $( this ).data( 'preset' ); + const bots = ( 'search' === preset ) ? ( window.noindexSeoAdmin.searchBots || [] ) : ( window.noindexSeoAdmin.aiBots || [] ); + const $rows = $( '.noindex-seo-robotstxt-rows' ).first(); + const max = parseInt( $rows.data( 'max-rules' ) || 30, 10 ); + + const existing = {}; + $rows.find( 'input[name="noindex_seo_robotstxt_agent[]"]' ).each( + function () { + existing[ $( this ).val().toLowerCase() ] = true; + } + ); + + bots.forEach( + function ( bot ) { + if ( existing[ bot.toLowerCase() ] ) { + return; + } + if ( $rows.find( '.noindex-seo-rule-row' ).length >= max ) { + return; + } + + const $clone = $rows.find( '.noindex-seo-rule-row' ).last().clone(); + $clone.find( 'input[name="noindex_seo_robotstxt_agent[]"]' ).val( bot ); + $clone.find( 'select' ).val( 'block' ); + $rows.append( $clone ); + } + ); + } + ); } /** @@ -163,63 +206,6 @@ // Can be enhanced with a tooltip library if needed. } - /** - * Initialize method-dependent field states - * Some fields only work with HTTP headers, not HTML meta tags - */ - function initMethodDependentFields() { - const methodSelect = $( '#noindex_seo_config_method' ); - - if (methodSelect.length === 0) { - return; - } - - /** - * Update field states based on selected implementation method - */ - function updateFieldStates() { - const method = methodSelect.val(); - const isHeaderEnabled = (method === 'header' || method === 'both'); - - // Contexts that ONLY work with HTTP headers (non-HTML content). - const headerOnlyContexts = [ - 'attachment', // Attachment pages (may contain PDFs, images, etc.). - 'feed', // RSS/Atom feeds (XML, not HTML). - 'comment_feed' // Comment feeds (XML, not HTML). - ]; - - headerOnlyContexts.forEach( - function (context) { - // Find all directive checkboxes for this context. - const directiveCheckboxes = $( 'input[name$="_seo_' + context + '"]' ); - const option = directiveCheckboxes.first().closest( '.noindex-seo-option' ); - - if ( ! isHeaderEnabled) { - // Disable all directives for this context. - directiveCheckboxes.prop( 'disabled', true ); - directiveCheckboxes.prop( 'checked', false ); - option.addClass( 'disabled' ); - option.attr( 'title', 'This option only works with HTTP Headers implementation method' ); - } else { - // Enable all directives for this context. - directiveCheckboxes.prop( 'disabled', false ); - option.removeClass( 'disabled' ); - option.removeAttr( 'title' ); - } - } - ); - - // Update stats after changing field states. - updateStats(); - } - - // Listen for method changes. - methodSelect.on( 'change', updateFieldStates ); - - // Execute on page load. - updateFieldStates(); - } - /** * Expand all cards */ @@ -325,9 +311,15 @@ if (urlParams.get( 'updated' ) === 'true') { showSuccessMessage( noindexSeoAdmin.successMessage || 'Settings saved successfully!' ); - // Remove the parameter from URL without reload. - const newUrl = window.location.pathname + window.location.hash; - window.history.replaceState( {}, document.title, newUrl ); + // Remove only the success flag, keeping the page and tab + // parameters intact (tabs are URL-based since 3.3.0). + urlParams.delete( 'updated' ); + const remaining = urlParams.toString(); + window.history.replaceState( + {}, + document.title, + window.location.pathname + ( remaining ? '?' + remaining : '' ) + ); } } ); diff --git a/assets/js/editor-sidebar.js b/assets/js/editor-sidebar.js index cec097a..66e3ea3 100644 --- a/assets/js/editor-sidebar.js +++ b/assets/js/editor-sidebar.js @@ -1,9 +1,11 @@ /** * Noindex SEO - Gutenberg Sidebar Panel - * Version: 2.0.0 + * Version: 3.0.0 * * Provides a native Gutenberg sidebar panel for controlling robots directives - * on individual posts and pages. + * on individual posts and pages: boolean flags plus the value directives + * introduced in 3.6.0 (max-snippet, max-image-preview, max-video-preview, + * unavailable_after). * * @package noindex-seo */ @@ -11,11 +13,21 @@ (function (wp) { const { registerPlugin } = wp.plugins; const { PluginDocumentSettingPanel } = wp.editPost; - const { CheckboxControl, PanelRow } = wp.components; + const { CheckboxControl, PanelRow, SelectControl, TextControl } = wp.components; const { useSelect, useDispatch } = wp.data; const { createElement: el } = wp.element; const { __ } = wp.i18n; + /** + * Boolean directives: checkbox controls backed by integer meta (0/1). + */ + const booleanDirectives = ['noindex', 'nofollow', 'noarchive', 'nosnippet', 'noimageindex', 'notranslate']; + + /** + * Value directives: inputs backed by string meta ('' = off). + */ + const valueDirectives = ['max-snippet', 'max-image-preview', 'max-video-preview', 'unavailable_after']; + /** * Robots Directives Sidebar Panel Component */ @@ -29,34 +41,42 @@ const { editPost } = useDispatch( 'core/editor' ); - // Current values. - const override = Boolean( postMeta._noindex_seo_override ); - const noindex = Boolean( postMeta._noindex_seo_noindex ); - const nofollow = Boolean( postMeta._noindex_seo_nofollow ); - const noarchive = Boolean( postMeta._noindex_seo_noarchive ); - const nosnippet = Boolean( postMeta._noindex_seo_nosnippet ); - const noimageindex = Boolean( postMeta._noindex_seo_noimageindex ); + // Current override state. + const override = Boolean( postMeta._noindex_seo_override ); - // Update meta function. - const updateMeta = function (key, value) { + // Update a boolean meta value (0/1). + const updateBoolean = function (key, value) { const newMeta = {}; newMeta[key] = value ? 1 : 0; editPost( { meta: newMeta } ); }; + // Update a value-directive meta value (string, '' = off). + const updateValue = function (key, value) { + const newMeta = {}; + newMeta[key] = value || ''; + editPost( { meta: newMeta } ); + }; + // Clear all directive meta values. const clearAllDirectives = function () { - const directives = ['noindex', 'nofollow', 'noarchive', 'nosnippet', 'noimageindex']; - directives.forEach( + const newMeta = {}; + booleanDirectives.forEach( function (directive) { - updateMeta( '_noindex_seo_' + directive, false ); + newMeta['_noindex_seo_' + directive] = 0; } ); + valueDirectives.forEach( + function (directive) { + newMeta['_noindex_seo_' + directive] = ''; + } + ); + editPost( { meta: newMeta } ); }; // Handle override toggle. const handleOverrideChange = function (value) { - updateMeta( '_noindex_seo_override', value ); + updateBoolean( '_noindex_seo_override', value ); // If disabling override, clear all directives. if ( ! value) { @@ -64,26 +84,91 @@ } }; - // Get active directives for preview. + // Build the preview list: names for booleans, name:value for values. const activeDirectives = []; if (override) { - if (noindex) { - activeDirectives.push( 'noindex' ); - } - if (nofollow) { - activeDirectives.push( 'nofollow' ); - } - if (noarchive) { - activeDirectives.push( 'noarchive' ); - } - if (nosnippet) { - activeDirectives.push( 'nosnippet' ); - } - if (noimageindex) { - activeDirectives.push( 'noimageindex' ); - } + booleanDirectives.forEach( + function (directive) { + if ( Boolean( postMeta['_noindex_seo_' + directive] ) ) { + activeDirectives.push( directive ); + } + } + ); + valueDirectives.forEach( + function (directive) { + const value = postMeta['_noindex_seo_' + directive]; + if ( value ) { + activeDirectives.push( directive + ':' + value ); + } + } + ); } + // Boolean directive rows. + const booleanRows = booleanDirectives.map( + function (directive) { + return el( + PanelRow, + { key: directive + '-row' }, + el( + CheckboxControl, + { + label: __( directive, 'noindex-seo' ), + checked: Boolean( postMeta['_noindex_seo_' + directive] ), + onChange: function (value) { + updateBoolean( '_noindex_seo_' + directive, value ); }, + } + ) + ); + } + ); + + // Value directive rows. + const valueRows = valueDirectives.map( + function (directive) { + const metaKey = '_noindex_seo_' + directive; + + if ( 'max-image-preview' === directive) { + return el( + PanelRow, + { key: directive + '-row' }, + el( + SelectControl, + { + label: __( directive, 'noindex-seo' ), + value: postMeta[metaKey] || '', + options: [ + { value: '', label: __( 'Off', 'noindex-seo' ) }, + { value: 'none', label: __( 'none', 'noindex-seo' ) }, + { value: 'standard', label: __( 'standard', 'noindex-seo' ) }, + { value: 'large', label: __( 'large', 'noindex-seo' ) }, + ], + onChange: function (value) { + updateValue( metaKey, value ); }, + } + ) + ); + } + + const inputType = ( 'unavailable_after' === directive) ? 'datetime-local' : 'number'; + + return el( + PanelRow, + { key: directive + '-row' }, + el( + TextControl, + { + type: inputType, + label: __( directive, 'noindex-seo' ), + value: ( postMeta[metaKey] || '' ).toString().replace( ' ', 'T' ), + onChange: function (value) { + updateValue( metaKey, value ); }, + } + ) + ); + } + ); + return el( PluginDocumentSettingPanel, { @@ -119,141 +204,68 @@ } }, [ - el( - 'p', - { - key: 'directives-label', - style: { - fontSize: '12px', - fontWeight: '600', - marginBottom: '12px', - color: '#1e1e1e', - } - }, - __( 'Robots Directives:', 'noindex-seo' ) - ), - - el( - PanelRow, - { key: 'noindex-row' }, - el( - CheckboxControl, - { - label: '🔍 ' + __( 'noindex', 'noindex-seo' ), - help: __( 'Prevent search engines from indexing', 'noindex-seo' ), - checked: noindex, - onChange: function (value) { - updateMeta( '_noindex_seo_noindex', value ); }, - } - ) - ), - - el( - PanelRow, - { key: 'nofollow-row' }, - el( - CheckboxControl, - { - label: '🔗 ' + __( 'nofollow', 'noindex-seo' ), - help: __( 'Prevent search engines from following links', 'noindex-seo' ), - checked: nofollow, - onChange: function (value) { - updateMeta( '_noindex_seo_nofollow', value ); }, - } - ) - ), - - el( - PanelRow, - { key: 'noarchive-row' }, - el( - CheckboxControl, - { - label: '💾 ' + __( 'noarchive', 'noindex-seo' ), - help: __( 'Prevent cached versions in search results', 'noindex-seo' ), - checked: noarchive, - onChange: function (value) { - updateMeta( '_noindex_seo_noarchive', value ); }, - } - ) - ), - - el( - PanelRow, - { key: 'nosnippet-row' }, - el( - CheckboxControl, - { - label: '📄 ' + __( 'nosnippet', 'noindex-seo' ), - help: __( 'Prevent text snippets in search results', 'noindex-seo' ), - checked: nosnippet, - onChange: function (value) { - updateMeta( '_noindex_seo_nosnippet', value ); }, - } - ) - ), - - el( - PanelRow, - { key: 'noimageindex-row' }, - el( - CheckboxControl, - { - label: '🖼️ ' + __( 'noimageindex', 'noindex-seo' ), - help: __( 'Prevent image indexing', 'noindex-seo' ), - checked: noimageindex, - onChange: function (value) { - updateMeta( '_noindex_seo_noimageindex', value ); }, - } - ) - ), - - // Preview section. - activeDirectives.length > 0 && el( - 'div', - { - key: 'preview-section', - style: { - marginTop: '16px', - padding: '12px', - background: '#f0f6fc', - border: '1px solid #0969da', - borderRadius: '4px', - } - }, - [ el( 'p', { - key: 'preview-label', - style: { - fontSize: '11px', - fontWeight: '600', - marginBottom: '8px', - color: '#0969da', - textTransform: 'uppercase', - } - }, - __( 'Active Directives:', 'noindex-seo' ) - ), - el( - 'code', - { - key: 'preview-code', + key: 'directives-label', style: { fontSize: '12px', - display: 'block', - padding: '8px', - background: '#fff', - border: '1px solid #d0d7de', - borderRadius: '3px', - wordBreak: 'break-word', + fontWeight: '600', + marginBottom: '12px', + color: '#1e1e1e', } }, - activeDirectives.join( ', ' ) + __( 'Robots Directives:', 'noindex-seo' ) + ), + booleanRows, + valueRows, + + // Preview section. + activeDirectives.length > 0 && el( + 'div', + { + key: 'preview-section', + style: { + marginTop: '16px', + padding: '12px', + background: '#f0f6fc', + border: '1px solid #0969da', + borderRadius: '4px', + } + }, + [ + el( + 'p', + { + key: 'preview-label', + style: { + fontSize: '11px', + fontWeight: '600', + marginBottom: '8px', + color: '#0969da', + textTransform: 'uppercase', + } + }, + __( 'Active Directives:', 'noindex-seo' ) + ), + el( + 'code', + { + key: 'preview-code', + style: { + fontSize: '12px', + display: 'block', + padding: '8px', + background: '#fff', + border: '1px solid #d0d7de', + borderRadius: '3px', + wordBreak: 'break-word', + } + }, + activeDirectives.join( ', ' ) + ) + ] ) - ] - ) ] ) ] diff --git a/changelog.txt b/changelog.txt index 0cf898f..a9ee4b0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,277 @@ == Changelog == += 3.7.0 = + +_Release date: 2026-11-03_ + +**Highlights** + +* Import from other SEO plugins (spec section 5): on-demand migration of the noindex / nofollow flags stored by Yoast SEO, Rank Math, SEOPress and All in One SEO into noindex SEO per-post and per-term overrides — detected from data presence (the source plugin does not need to be installed), user-confirmed, and never overwriting content that already has its own override. +* Virtual robots.txt management (spec section 7): block (`Disallow: /`) or allow (`Allow: /`) individual crawlers, appended to the robots.txt WordPress generates virtually — never replacing it — with one-click presets for the well-known AI and search-engine crawlers. Inactive by default. + +**Added** + +* **Import from other plugins.** A new section on the Import / Export tab lists every supported source plugin together with how many posts and terms carry its robots flags, and imports the checked ones on explicit confirmation. The runner converts source flags into granular overrides (`_noindex_seo_override=1` plus noindex / nofollow), skips and reports content that already carries a noindex SEO override row (an explicit "off" counts as data), re-verifies LIKE-based matches (Rank Math's serialized arrays) per post so false positives are dropped, and whitelists source slugs server-side. Sources are data-driven and filterable (`noindex_seo_import_sources`) so third parties can register or correct one. +* **Robots.txt tab.** A fourth settings tab manages up to 30 bot rules (User-agent token + block/allow policy; `*` wildcard supported, duplicates collapse, agents stripped to the robots.txt-legal charset). The rules are appended through core's `robots_txt` filter only while the feature is enabled, a live preview shows the exact block appended, and preset buttons add the well-known AI crawlers (GPTBot, ClaudeBot, Google-Extended, CCBot, Bytespider… — filterable via `noindex_seo_ai_bots`) or the main search engine crawlers (`noindex_seo_search_bots`) as blocked rules. The core output — and a physical robots.txt or "Discourage search engines" — always takes precedence. +* The robots.txt settings ride the consolidated option and the JSON export/import. + +**Changed** + +* The settings page gained a fourth tab (General / SEO Settings / Import-Export / Robots.txt); the rule-table JavaScript is now shared between the conditional rules and the robots.txt tables, scoped per container. + +**Fixed** + +* Block editor granular overrides now save on custom post types registered without `custom-fields` support (a very common CPT registration). Without that support the REST API exposes no `meta` field for the post type, so the editor sidebar's saves were silently dropped with an HTTP 200 — the override checkbox appeared to do nothing. The plugin now adds `custom-fields` support for exactly the post types it registers meta on (while per-post granular control is enabled). + +**Security** + +* No new attack surface: the import handler is `manage_options` + nonce gated with whitelisted sources, writes only through the meta API after re-reading each source flag, and skips content with existing override data; robots.txt agents are charset-stripped (no newline or comment injection into the file) and policies are whitelisted; the tab form rides the existing nonce + capability path. PHPCS/PHPStan/composer audit clean. + +**Compatibility** + +* WordPress: 7.0 - 7.2 +* PHP: 8.3 - 8.6 + +**Tests** + +* PHPUnit: 9.6.38 (230 tests, 1152 assertions, all passing) on the WordPress 7.2-beta3 test library, run under PHP 8.3, 8.4, 8.5 and 8.6.0RC3 — including the new robots.txt sanitization/output/filter/form suites and the import detection/conversion/never-overwrite/false-positive/handler suites. +* PHPCompatibility: 0 errors on the declared range 8.3-8.6 and on the full review range 5.6-8.6. +* PHPCS (WordPress-Core, -Docs, -Extra) and PHPStan level 9: 0 errors. +* Translations: Catalan and Spanish catalogs regenerated and 100% complete (209 strings each). + += 3.6.0 = + +_Release date: 2026-11-03_ + +**Highlights** + +* Modern robots directives (TODO #5): `notranslate`, `max-snippet`, `max-image-preview`, `max-video-preview` and `unavailable_after` join the five existing booleans — on every surface: the global context grid, per-post and per-term granular overrides, Quick Edit, the block editor sidebar, the REST `/effective` endpoint and WP-CLI (`name=value` tokens). +* Conditional auto-noindex rules (TODO #11): apply `noindex` automatically to any post whose custom field (for example an ACF field) exactly matches a value; matched posts also drop out of the core XML sitemap. +* Multisite behavior documented (TODO #9, docs variant): per-site by design, with an export/import-based rollout recipe. + +**Added** + +* **Value directives everywhere.** Boolean directives are flags; value directives carry a value and render as `name:value` (`max-snippet:-1`, `max-image-preview:large`, `unavailable_after: Tue, 01 Jan 2030 09:00:00 +0000` in site time with a numeric UTC offset). They are configured with typed inputs (number, size select, `datetime-local`) on the settings grid, the post meta box, Quick Edit, the term panel and the Gutenberg sidebar; stored in the consolidated option (contexts) and in `_noindex_seo_{directive}` post/term meta; registered with the REST API (`register_post_meta`/`register_term_meta` with per-type sanitization); exported/imported with normalization; and supported by WP-CLI — `wp noindex-seo set archive max-snippet=-1 max-image-preview=large`, `wp noindex-seo unset archive max-snippet` (plain name clears the value), and `list` reports the configured value (`max-snippet:-1`) or `off`. +* **`notranslate`** as the sixth boolean directive, including a matching SVG icon in the plugin's icon registry and membership in the "Apply Recommended Defaults" set (which enables the six booleans; value directives stay untouched — "enabling" them without a value is meaningless). +* **Conditional rules (TODO #11).** A "Conditional rules" card on the SEO Settings tab manages up to 20 exact-match rules (custom field name + value; rows with empty field/value are ignored, and the plugin's own `_noindex_seo_` meta keys are rejected). Rules run on the front-end below an explicit per-post override and above per-CPT/global defaults; matched posts surface as `source: auto_rule` in `/effective` and are excluded from the pages sitemap. The rules read plain post meta, so no ACF installation is required. +* A `notranslate` SVG directive icon, plus badge support for value directives in the Robots columns (`max-snippet:-1` tokens). + +**Changed** + +* `noindex_seo_metarobots()` now takes a directive **map** (`name => true|value`); a flat list of boolean names (the pre-3.6.0 third-party calling convention) is still accepted and normalized. The `wp_robots` integration passes directive values through to core (`$robots['max-snippet'] = '-1'`). +* `noindex_seo_get_setting()` returns the normalized string value for value directives ('' = off) instead of coercing everything to 0/1; the hourly transient cache stores values the same way. +* The WP-CLI `set`/`unset` default (no directive arguments) now enables/disables the six boolean directives; value directives always require explicit `name=value` tokens (a value on a boolean, or an invalid/missing value, is rejected with a descriptive error). Datetime values need quoting or a `T` separator because of the space: `unavailable_after=2030-01-01T09:00`. +* Block editor sidebar labels dropped their emoji prefixes (matching the 3.5.0 admin UI icon direction), and the sidebar gained controls for all five new directives. + +**Fixed** + +* Nothing. + +**Security** + +* No new attack surface: rules and value directives ride the existing nonce + capability paths (settings form: `manage_options` + `check_admin_referer`; meta box/Quick Edit: `edit_post`; term panel: `manage_categories`); every value normalizes through a single whitelist-driven normalizer (integers ≥ -1, a none/standard/large enum, a parse-validated datetime); rule fields strip everything but `[A-Za-z0-9_-]` and values go through `sanitize_text_field()`; sitemap rule clauses use WP_Query's `meta_query` (prepared by core). PHPCS/PHPStan/composer audit clean. + +**Compatibility** + +* WordPress: 7.0 - 7.2 +* PHP: 8.3 - 8.6 + +**Tests** + +* PHPUnit: 9.6.38 (216 tests, 1107 assertions, all passing) on the WordPress 7.2-beta3 test library, run under PHP 8.3, 8.4, 8.5 and 8.6.0RC3 — including the new registry/normalization, settings-merge, form-roundtrip, front-end value output, granular value overrides, REST formatted tokens, CLI name=value, rules sanitization/matching/precedence/sitemap/auto_rule suites. +* PHPCompatibility: 0 errors on the declared range 8.3-8.6 and on the full review range 5.6-8.6. +* PHPCS (WordPress-Core, -Docs, -Extra) and PHPStan level 9: 0 errors. +* Translations: Catalan and Spanish catalogs regenerated and 100% complete (188/187 strings), including the previously untranslated strings found during the merge. + += 3.5.0 = + +_Release date: 2026-11-03_ + +**Highlights** + +* WooCommerce special-page contexts (TODO #8): dedicated directives for the WooCommerce 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 narrowed to WordPress 7.0 - 7.2 and PHP 8.3 - 8.6: `Requires at least` raised from 4.7 to 7.0, `Requires PHP` raised from 5.6 to 8.3, `Tested up to` set to WordPress 7.2 (verified on 7.2-beta3) and PHP support documented through 8.6 (verified on 8.6.0RC3). +* Fixed `wp noindex-seo list`, which fatalled on every real WP-CLI invocation since 3.4.0 (nonexistent static API call; `--context` filter renamed to `--only` to avoid WP-CLI 2.11+'s reserved global flag). +* Directive icons modernized for the SVG era: on WordPress 7.2+ the five directive icons render through the core Icons API — the same system WordPress 7.2 uses for its own admin chrome — while WordPress 7.0 - 7.1 keep the legacy emoji glyphs as a retrocompatible fallback. + +**Added** + +* **WooCommerce contexts** (`woo_cart`, `woo_checkout`, `woo_myaccount`): the Cart, Checkout and My Account pages are regular pages that conventionally deserve noindex but previously fell into the generic `page` bucket. Each now has its own context with all five directives, a "WooCommerce" section on the SEO Settings tab (rendered only when the store pages are configured), and Recommended badges — the three contexts also joined the "Apply Recommended Defaults" set (now 15 contexts). +* Detection is option-driven (`woocommerce_cart_page_id`, `woocommerce_checkout_page_id`, `woocommerce_myaccount_page_id`): no WooCommerce class or function dependency; without WooCommerce the contexts are inert. My Account endpoints (order history, addresses) and the checkout order-pay / order-received endpoints share their parent page's ID, so they are covered automatically. +* Precedence: the dedicated contexts run before the generic `page` context on the front-end and in `/wp-json/noindex-seo/v1/effective`, so a Woo page with directives gets them instead of the page-level ones; with no dedicated directives the page context still applies. +* Sitemap: special pages whose context has `noindex=1` drop out of the pages sitemap even when the `page` context is not noindexed. +* **SVG directive icons (retrocompatible).** The five robots-directive icons render as color-adaptive 16px SVGs through the WordPress Icons API (`wp_register_icon()` / `wp_get_icon()`), registered in a private `noindex-seo` icon collection — everywhere they appear: the settings grid, the post meta box, Quick Edit, and the post and taxonomy list-table Robots columns. The SVG path is gated to WordPress 7.2+, whose icon sanitizer understands the stroke-based designs (rect/circle, `stroke*` attributes) and whose registry supports private collections; on WordPress 7.0 - 7.1 the legacy emoji glyphs remain (7.1's narrower sanitizer would strip the SVGs to unstyled fragments), so rendering stays correct on every supported version — and consistent on every OS, unlike the emoji (which each platform draws differently). Follows the core direction of replacing admin dashicons with SVG (wordpress-develop#12270, landed in WP 7.2's admin chrome). The Quick Edit label strings dropped their emoji prefix; the plain directive names were already in the translation catalogs, so no translations were lost. + +**Changed** + +* Compatibility window: WordPress 7.0 - 7.2 (was 4.7 - 7.2), PHP 8.3 - 8.6 (was 5.6 - 8.5). The full-range PHPCompatibility scan (PHP 5.6 - 8.6) still passes clean — the code keeps its PHP 5.6-parseable syntax — but the declared and supported window is now 7.0 / 8.3 and up, per the product support policy. The runtime guards for WordPress APIs older than 7.0 remain in place as harmless no-ops and may be removed in 4.0. +* Tooling aligned with the new window: `phpcs.xml` `testVersion` 8.3-8.6 and `minimum_supported_wp_version` 7.0, `phpstan.neon` `phpVersion` 80300, `bin/preflight.sh` gates scanning the declared range, `composer.json` PHP constraint `>=8.3`, and the obsolete `WPCompat.*` PHPStan ignores removed (every guarded hook exists since 7.0). +* Development dependencies refreshed via `composer update`: PHPUnit 9.6.38, PHPStan 2.3.5, wordpress-stubs 7.1.2 (no CVEs; `composer audit` clean). +* The "Apply Recommended Defaults" set grew from 12 to 15 contexts (button title and description updated; existing configurations are untouched — the button is opt-in). + +**Fixed** + +* `wp noindex-seo list` was broken on real WP-CLI installs since 3.4.0: the output call went to `WP_CLI\Utils::format_items()` (a static method that does not exist — the real API is the namespaced `WP_CLI\Utils\format_items()` function), and the `--context` filter parameter collided with the `--context` global flag reserved by WP-CLI 2.11+, so the value never reached the handler. The filter is now `--only=` and the command renders through the real function API. The unit-test stub was aligned with the real WP-CLI surface (namespaced function, not a Utils class), and every `wp noindex-seo` command was smoke-tested against the real WP-CLI 2.12 phar. + +**Security** + +* No security changes; the new contexts reuse the consolidated settings storage and existing sanitization paths, and PHPCS/PHPStan/composer audit stay clean. + +**Compatibility** + +* WordPress: 7.0 - 7.2 +* PHP: 8.3 - 8.6 + +**Tests** + +* PHPUnit: 9.6.38 (198 tests, 817 assertions, all passing) on the WordPress 7.2-beta3 test library, run under PHP 8.3, 8.4, 8.5 and 8.6.0RC3 — including the icon registration, SVG rendering, emoji fallback and admin-markup tests. +* PHPCompatibility: 0 errors on the declared range 8.3-8.6 and on the full review range 5.6-8.6. +* PHPCS (WordPress-Core, WordPress-Docs, WordPress-Extra) and PHPStan level 9: 0 errors. + += 3.4.0 = + +_Release date: 2026-09-19_ + +**Highlights** + +* WP-CLI support (TODO #7): a `wp noindex-seo` command namespace with list, set, unset, export, import and bulk per-post overrides — automation-friendly and scaling past the ~200-post ceiling of the bulk UI. + +**Added** + +* **WP-CLI commands.** `wp noindex-seo list [--context=] [--format=table|csv|json|yaml]` (every context × directive pair with its status), `wp noindex-seo set [...]` / `wp noindex-seo unset [...]` (default: all five directives; saving clears the transient cache), `wp noindex-seo export []` (JSON payload to STDOUT or a file, same as the tools tab), `wp noindex-seo import [--dry-run]` (same validation and sanitization as the import form; `--dry-run` reports the number of values that would change), and `wp noindex-seo override ... [--off]` (bulk per-post granular overrides without the UI's selection limit; `--off` clears the override and directive meta). The commands enforce the same rules as the settings page: unknown contexts/directives are rejected and the attachment context refuses to enable while the implementation method is meta-only. +* `stubs/wp-cli-stubs.php`: minimal WP-CLI signatures for PHPStan and a recording stub for the test suite (never shipped; excluded from the release ZIP and from PHPCS). +* The undefined "migrate-attachments" command from the original TODO was replaced by the general-purpose `override` bulk command, which covers the same need for every post type. + +**Changed** + +* Nothing. + +**Fixed** + +* Nothing. + +**Security** + +* No security changes; the CLI handlers reuse the existing validated/sanitized helpers, operator-supplied file paths are checked with `is_readable()` before reading, and PHPCS/PHPStan/composer audit stay clean. + +**Compatibility** + +* WordPress: 4.7 - 7.2 +* PHP: 5.6 - 8.5 + +**Tests** + +* PHPUnit: 9.6.36 (185 tests, all passing): command registration, set/unset round-trips (including transient invalidation and defaults), unknown context/directive rejection, the attachment header-only invariant, list rows and filtering, export to STDOUT and file, import dry-run/apply/rejection, and override enable/disable/skip-missing. + += 3.3.0 = + +_Release date: 2026-09-19_ + +**Highlights** + +* The settings page is reorganized with the native WordPress tab navigation (General / SEO Settings / Import-Export) and titled sections, built exclusively on core `nav-tab` classes with URL-based switching — no proprietary tab CSS or JavaScript. + +**Added** + +* Native WordPress tab navigation on the settings page (`nav-tab-wrapper` / `nav-tab`, the same pattern as the core Updates and Plugins screens): General (implementation method and configuration options), SEO Settings (the directive grid), and Import / Export (the JSON tools). Tabs switch through the `tab` query parameter and the active panel renders server-side, so they work without JavaScript and are bookmarkable. +* Titled sections inside the tabs: "Recommended settings" (one-click defaults), "Overview" (the number cards) and "Page contexts" (the directive grid) on SEO Settings; "Export settings" and "Import settings" headers on the Import / Export tab. Spacing added between the tab bar and the content below. + +**Changed** + +* `noindex_seo_process_form()` is now tab-scoped: saving from the General tab updates only the configuration and preserves the directive grid, saving from SEO Settings updates only the directives and preserves the configuration — hidden tabs can no longer reset each other's values. The form carries a `noindex_seo_form_scope` marker and the redirect returns to the tab the user saved from. +* The header-only restriction for the attachment context now follows the saved implementation method (the method select lives on the General tab), and switching the method to meta/HTML-only from General zeroes the attachment directives to keep the invariant consistent. +* The apply-suggestions redirect and the import success/error redirects return to their source tabs (`tab=settings`, `tab=tools`). +* Removed the dead custom tab machinery: the `.noindex-seo-tab*` CSS rules, the `initTabs()` JavaScript with its localStorage persistence, and the unused `.noindex-seo-apply-note` class (previously flagged as dead code by the 3.1.6 deploy audit). + +**Fixed** + +* Nothing. + +**Security** + +* No security changes; the tab parameter is strictly safelisted server-side (`sanitize_key` + allow list) and PHPCS/PHPStan/composer audit stay clean. + +**Compatibility** + +* WordPress: 4.7 - 7.2 +* PHP: 5.6 - 8.5 + +**Tests** + +* PHPUnit: 9.6.36 (172 tests, all passing): tab markup (three tabs, active class, unknown-tab fallback), per-tab rendering isolation, scope-aware saving (config-only / grid-only / preserve-other-side / attachment invariant / tab-aware redirect), and section ordering. + += 3.2.0 = + +_Release date: 2026-09-18_ + +**Highlights** + +* Two roadmap features: JSON export/import of the settings (#6) and runtime conflict verification against the `wp_robots` API (#10). + +**Added** + +* **Export / Import of settings (JSON).** Two new controls on the settings page: "Export settings" downloads the consolidated settings as a JSON file (`noindex-seo-settings-{date}.json`), and "Import settings" restores the global settings from a previously exported file. Imports are strictly validated and sanitized: plugin marker check, 1 MB size limit, `is_uploaded_file()` verification, the upload is never persisted to the uploads directory, every directive is normalized to 0/1, config values go through the same safelists as the settings form, and contexts that do not exist on the importing site (e.g. custom post types from another install) are dropped. Per-post and per-term granular overrides are content data and are never touched by an import. Both actions require `manage_options` and a nonce; success and error notices survive the redirect. +* **Runtime conflict verification (TODO #10).** When no known SEO plugin conflicts, `noindex_seo_detect_conflicts()` now also inspects the callbacks actually registered on the `wp_robots` filter (WordPress 5.7+): anything that is not a core callback or one of ours — a foreign function, a class method, or a closure from a theme or unknown plugin — produces a dismissible admin notice naming the detected callback. The core callback safelist is filterable via `noindex_seo_core_robots_callbacks`. The notice honours the existing "disable compatibility warnings" opt-out. + +**Changed** + +* Nothing. + +**Fixed** + +* Nothing. + +**Security** + +* No security changes; the new endpoints follow the canonical checklist (capability + nonce on both actions, strict input validation, safelisted config values, no persistence of uploads) and PHPCS/PHPStan/composer audit stay clean. + +**Compatibility** + +* WordPress: 4.7 - 7.2 +* PHP: 5.6 - 8.5 + +**Tests** + +* PHPUnit: 9.6.36 (165 tests, all passing): export payload shape and JSON round-trip, import sanitizer (happy path, normalization, unknown-context dropping, malformed-payload rejection), handler guards, foreign-callback detection (functions, class methods, closures, own-prefix skipping, filterable safelist) and the runtime notice. + += 3.1.6 = + +_Release date: 2026-09-18_ +**Highlights** + +* Admin UI modernization: all inline styles removed in favour of WordPress admin color-scheme-aware, RTL-ready classes (audit finding M7), plus the two minor items deferred from the 3.1.5 deploy audit (stale wp_die message, unreachable REST fallbacks). + +**Added** + +* Regression tests locking in the new UI conventions: the settings page and meta box render without any `style="..."` attribute, and the stylesheet is verified to load on the post-list / post-edit / term-edit screens (gated by the granular flags) while staying off everything else. + +**Changed** + +* All 61 inline `style="..."` attributes removed from the settings page, post meta box, term edit panel, Quick Edit, and the post/term list "Robots" columns. Styling now lives in `assets/css/admin.css` under semantic class names. +* Admin styling now follows the WordPress admin color scheme: accents use `var(--wp-admin-theme-color, #2271b1)`, status boxes and badges use the core admin palette, and neutral grays match wp-admin. The UI adapts to Light / Blue / Midnight / Coffee / Ocean / etc. instead of hardcoded Material-Design colors. +* RTL support: layout uses logical CSS properties (`margin-inline-start`, `border-inline-start`) and the toggle switch mirrors under `[dir="rtl"]`. +* Dynamic visibility (override toggles in the meta box and term panel) uses the core `.hidden` class with `classList.toggle()` instead of inline `display` manipulation. +* `assets/css/admin.css` also enqueues on the admin screens where the plugin renders UI (post list, post editor, term editor), gated by the granular-control flags; the interactive JavaScript remains settings-page-only. +* Admin stylesheet cleanup: duplicate `.noindex-seo-view-link` rule block removed; keyframe names prefixed to avoid collisions. + +**Fixed** + +* Stale `wp_die()` message in the two form handlers: after the 3.1.5 nonce split only the capability path is reachable there, so the message is now "Permission denied." instead of "Permission denied or invalid nonce." (deploy-audit finding I2). Catalan and Spanish translations and the `.pot` template updated; `.mo` files recompiled. +* Unreachable `function_exists( 'rest_authorization_required_code' )` ternaries removed from both REST permission callbacks — the function exists on every supported WordPress version (deploy-audit finding I5). + +**Security** + +* No security changes; the full canonical checklist (`AGENTS-security.md`), PHPCS security sniffs and `composer audit` remain clean. + +**Compatibility** + +* WordPress: 4.7 - 7.2 +* PHP: 5.6 - 8.5 + +**Tests** + +* PHPUnit: 9.6.36 (150 tests, all passing). Coverage maintained above the 80% floor. + = 3.1.5 = _Release date: 2026-09-18_ diff --git a/languages/noindex-seo-ca.mo b/languages/noindex-seo-ca.mo index 60c5bde..ced548a 100644 Binary files a/languages/noindex-seo-ca.mo and b/languages/noindex-seo-ca.mo differ diff --git a/languages/noindex-seo-ca.po b/languages/noindex-seo-ca.po index d13675f..bb8b655 100644 --- a/languages/noindex-seo-ca.po +++ b/languages/noindex-seo-ca.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: noindex SEO 3.1.3\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/noindex-seo\n" -"POT-Creation-Date: 2026-08-17T19:24:59+00:00\n" +"POT-Creation-Date: 2026-11-03T20:17:27+00:00\n" "PO-Revision-Date: 2026-08-17T20:00+00:00\n" "Last-Translator: ROBOTSTXT \n" "Language-Team: Catalan — https://translate.wordpress.org/locale/ca/default/\n" @@ -18,7 +18,7 @@ msgstr "" "X-Domain: noindex-seo\n" #. Plugin Name of the plugin -#: noindex-seo.php noindex-seo.php:1405 noindex-seo.php:1406 +#: noindex-seo.php noindex-seo.php:2590 noindex-seo.php:2591 msgid "noindex SEO" msgstr "noindex SEO" @@ -48,40 +48,40 @@ msgstr "ROBOTSTXT" msgid "https://www.robotstxt.software/" msgstr "https://www.robotstxt.software/" -#: noindex-seo.php:1036 +#: noindex-seo.php:1993 msgid "Post ID to compute effective directives for." msgstr "ID de l'entrada per a calcular les directives efectives." -#: noindex-seo.php:1065 +#: noindex-seo.php:2020 msgid "You do not have permission to read the noindex SEO settings." msgstr "No teniu permís per a llegir els ajustaments de noindex SEO." -#: noindex-seo.php:1118 +#: noindex-seo.php:2070 msgid "You do not have permission to read directives for this post." msgstr "No teniu permís per a llegir les directives d'aquesta entrada." -#: noindex-seo.php:1176 +#: noindex-seo.php:2133 msgid "No post exists with that post_id." msgstr "No existeix cap entrada amb aquest post_id." -#: noindex-seo.php:1301 +#: noindex-seo.php:2439 msgid "Settings saved successfully!" msgstr "S'han desat els ajustaments correctament." -#: noindex-seo.php:1302 +#: noindex-seo.php:2440 msgid "Expand All" msgstr "Expandeix-ho tot" -#: noindex-seo.php:1303 +#: noindex-seo.php:2441 msgid "Collapse All" msgstr "Redueix-ho tot" -#: noindex-seo.php:1385 +#: noindex-seo.php:2523 msgid "Settings" msgstr "Ajustaments" #. translators: plugin name. -#: noindex-seo.php:1627 +#: noindex-seo.php:2816 #, php-format msgid "" "noindex SEO has detected that %s is active. This may cause conflicts. Please " @@ -90,19 +90,32 @@ msgstr "" "noindex SEO ha detectat que %s és actiu. Això pot causar conflictes. " "Configureu les opcions en conseqüència." -#: noindex-seo.php:1657 noindex-seo.php:1756 -msgid "Permission denied or invalid nonce." -msgstr "S'ha denegat el permís o el nonce no és vàlid." +#. translators: %s: comma-separated list of wp_robots callbacks. +#: noindex-seo.php:2837 +#, php-format +msgid "" +"noindex SEO has detected that another plugin or theme is adding robots " +"directives through the wp_robots API (%s). This may cause conflicts. Please " +"configure the options accordingly." +msgstr "" +"noindex SEO ha detectat que un altre complement o tema està afegint " +"directrius de robots a través de l'API wp_robots (%s). Això pot causar " +"conflictes. Configureu les opcions en conseqüència." -#: noindex-seo.php:1914 noindex-seo.php:2238 assets/js/editor-sidebar.js:91 +#: noindex-seo.php:2954 noindex-seo.php:3129 noindex-seo.php:3180 +#: noindex-seo.php:3284 noindex-seo.php:3345 +msgid "Permission denied." +msgstr "S'ha denegat el permís." + +#: noindex-seo.php:4033 noindex-seo.php:4422 assets/js/editor-sidebar.js:176 msgid "Search Engine Visibility" msgstr "Visibilitat als cercadors" -#: noindex-seo.php:1966 noindex-seo.php:2597 assets/js/editor-sidebar.js:102 +#: noindex-seo.php:4094 noindex-seo.php:4792 assets/js/editor-sidebar.js:187 msgid "Override global settings" msgstr "Sobreescriu els ajustaments globals" -#: noindex-seo.php:1971 +#: noindex-seo.php:4099 msgid "" "When enabled, these directives will override the global settings for this " "specific content." @@ -110,104 +123,169 @@ msgstr "" "En activar-se, aquestes directrius sobreescriuran els ajustaments globals " "per a aquest contingut específic." -#: noindex-seo.php:1978 +#: noindex-seo.php:4106 msgid "Prevent indexing" msgstr "Evita la indexació" -#: noindex-seo.php:1983 +#: noindex-seo.php:4111 msgid "Prevent link following" msgstr "Evita el seguiment d'enllaços" -#: noindex-seo.php:1988 +#: noindex-seo.php:4116 msgid "Prevent caching" msgstr "Evita la memòria cau" -#: noindex-seo.php:1993 +#: noindex-seo.php:4121 msgid "Prevent snippets" msgstr "Evita els fragments" -#: noindex-seo.php:1998 assets/js/editor-sidebar.js:203 +#: noindex-seo.php:4126 msgid "Prevent image indexing" msgstr "Evita la indexació d'imatges" -#: noindex-seo.php:2006 +#: noindex-seo.php:4131 +msgid "Prevent translation" +msgstr "Evita la traducció" + +#: noindex-seo.php:4136 +msgid "Value directives (empty = off):" +msgstr "Directives amb valor (buit = desactivat):" + +#: noindex-seo.php:4139 noindex-seo.php:4145 noindex-seo.php:4154 +#: noindex-seo.php:4441 noindex-seo.php:4449 noindex-seo.php:4826 +#: noindex-seo.php:4831 noindex-seo.php:4839 noindex-seo.php:5923 +#: noindex-seo.php:5939 assets/js/editor-sidebar.js:141 +msgid "Off" +msgstr "Desactivat" + +#: noindex-seo.php:4140 noindex-seo.php:5589 +msgid "Maximum snippet length in characters (-1 = no limit)" +msgstr "Longitud màxima del fragment en caràcters (-1 = sense límit)" + +#: noindex-seo.php:4146 noindex-seo.php:4442 noindex-seo.php:4832 +#: noindex-seo.php:5940 assets/js/editor-sidebar.js:142 +msgid "none" +msgstr "cap" + +#: noindex-seo.php:4147 noindex-seo.php:4443 noindex-seo.php:4833 +#: noindex-seo.php:5941 assets/js/editor-sidebar.js:143 +msgid "standard" +msgstr "estàndard" + +#: noindex-seo.php:4148 noindex-seo.php:4444 noindex-seo.php:4834 +#: noindex-seo.php:5942 assets/js/editor-sidebar.js:144 +msgid "large" +msgstr "gran" + +#: noindex-seo.php:4150 noindex-seo.php:5594 +msgid "Maximum image preview size" +msgstr "Mida màxima de la previsualització d'imatges" + +#: noindex-seo.php:4155 noindex-seo.php:5599 +msgid "Maximum video preview seconds (-1 = no limit)" +msgstr "Segons màxims de la previsualització de vídeo (-1 = sense límit)" + +#: noindex-seo.php:4160 +msgid "Stop indexing after this date and time" +msgstr "Deixa d'indexar després d'aquesta data i hora" + +#: noindex-seo.php:4168 msgid "Effective Directives:" msgstr "Directrius efectives:" -#: noindex-seo.php:2031 +#: noindex-seo.php:4178 msgid "Override active:" msgstr "Sobreescriptura activa:" -#: noindex-seo.php:2036 +#: noindex-seo.php:4183 msgid "Override enabled but no directives selected" msgstr "Sobreescriptura activada però sense directrius seleccionades" -#: noindex-seo.php:2042 +#: noindex-seo.php:4189 msgid "Global settings:" msgstr "Ajustaments globals:" -#: noindex-seo.php:2047 +#: noindex-seo.php:4194 msgid "No restrictions (indexable)" msgstr "Sense restriccions (indexable)" -#: noindex-seo.php:2242 +#: noindex-seo.php:4426 msgid "Override global settings for this term" msgstr "Sobreescriu els ajustaments globals d'aquest terme" -#: noindex-seo.php:2255 +#: noindex-seo.php:4457 msgid "" "When override is enabled, the directives checked above apply to this term's " "archive page and take precedence over the global category / tag / archive " "settings." msgstr "" -"Quan l'opció de sobreescriptura està activada, les directives marcades a" -"sobre s'apliquen a la pàgina d'arxiu d'aquest terme i prevalen sobre els" -"ajustaments globals de categories, etiquetes i arxius." +"Quan l'opció de sobreescriptura està activada, les directives marcades " +"asobre s'apliquen a la pàgina d'arxiu d'aquest terme i prevalen sobre " +"elsajustaments globals de categories, etiquetes i arxius." - -#: noindex-seo.php:2350 noindex-seo.php:2356 noindex-seo.php:2488 -#: noindex-seo.php:2494 +#: noindex-seo.php:4559 noindex-seo.php:4565 noindex-seo.php:4681 +#: noindex-seo.php:4687 msgid "Robots" msgstr "Robots" -#: noindex-seo.php:2417 noindex-seo.php:2543 +#: noindex-seo.php:4623 noindex-seo.php:4742 msgid "Override (none)" msgstr "Sobreescriptura (cap)" -#: noindex-seo.php:2593 +#: noindex-seo.php:4788 msgid "Robots Directives" msgstr "Directrius Robots" -#: noindex-seo.php:2602 -msgid "🔍 noindex" -msgstr "🔍 noindex" +#: noindex-seo.php:4798 noindex-seo.php:5558 +msgid "noindex" +msgstr "noindex" -#: noindex-seo.php:2606 -msgid "🔗 nofollow" -msgstr "🔗 nofollow" +#: noindex-seo.php:4803 noindex-seo.php:5563 +msgid "nofollow" +msgstr "nofollow" -#: noindex-seo.php:2610 -msgid "💾 noarchive" -msgstr "💾 noarchive" +#: noindex-seo.php:4808 noindex-seo.php:5568 +msgid "noarchive" +msgstr "noarchive" -#: noindex-seo.php:2614 -msgid "📄 nosnippet" -msgstr "📄 nosnippet" +#: noindex-seo.php:4813 noindex-seo.php:5573 +msgid "nosnippet" +msgstr "nosnippet" -#: noindex-seo.php:2618 -msgid "🖼️ noimageindex" -msgstr "🖼️ noimageindex" +#: noindex-seo.php:4818 noindex-seo.php:5578 +msgid "noimageindex" +msgstr "noimageindex" -#: noindex-seo.php:2729 +#: noindex-seo.php:4823 noindex-seo.php:5583 +msgid "notranslate" +msgstr "notranslate" + +#: noindex-seo.php:4827 noindex-seo.php:5588 +msgid "max-snippet" +msgstr "max-snippet" + +#: noindex-seo.php:4836 noindex-seo.php:5593 +msgid "max-image-preview" +msgstr "max-image-preview" + +#: noindex-seo.php:4840 noindex-seo.php:5598 +msgid "max-video-preview" +msgstr "max-video-preview" + +#: noindex-seo.php:4844 noindex-seo.php:5603 +msgid "unavailable_after" +msgstr "unavailable_after" + +#: noindex-seo.php:4957 msgid "Enable Robots Override" msgstr "Activa la sobreescriptura Robots" -#: noindex-seo.php:2730 +#: noindex-seo.php:4958 msgid "Disable Robots Override" msgstr "Desactiva la sobreescriptura Robots" #. translators: %d: Number of posts updated -#: noindex-seo.php:2827 +#: noindex-seo.php:5050 #, php-format msgid "Robots override enabled for %d post." msgid_plural "Robots override enabled for %d posts." @@ -215,320 +293,359 @@ msgstr[0] "S'ha activat la sobreescriptura Robots per a %d entrada." msgstr[1] "S'ha activat la sobreescriptura Robots per a %d entrades." #. translators: %d: Number of posts updated -#: noindex-seo.php:2848 +#: noindex-seo.php:5071 #, php-format msgid "Robots override disabled for %d post." msgid_plural "Robots override disabled for %d posts." msgstr[0] "S'ha desactivat la sobreescriptura Robots per a %d entrada." msgstr[1] "S'ha desactivat la sobreescriptura Robots per a %d entrades." -#: noindex-seo.php:2897 +#: noindex-seo.php:5120 msgid "All robots settings" msgstr "Tots els ajustaments robots" -#: noindex-seo.php:2899 +#: noindex-seo.php:5122 msgid "With override" msgstr "Amb sobreescriptura" -#: noindex-seo.php:2902 +#: noindex-seo.php:5125 msgid "Without override" msgstr "Sense sobreescriptura" -#: noindex-seo.php:3016 +#: noindex-seo.php:5244 msgid "You do not have sufficient permissions to access this page." msgstr "No teniu permisos suficients per a accedir a aquesta pàgina." -#: noindex-seo.php:3017 +#: noindex-seo.php:5245 msgid "Permission Denied" msgstr "Permís denegat" -#: noindex-seo.php:3039 +#: noindex-seo.php:5257 +msgid "General" +msgstr "General" + +#: noindex-seo.php:5258 +msgid "SEO Settings" +msgstr "Ajustaments SEO" + +#: noindex-seo.php:5259 +msgid "Import / Export" +msgstr "Importació i exportació" + +#: noindex-seo.php:5260 +msgid "Robots.txt" +msgstr "Robots.txt" + +#: noindex-seo.php:5280 msgid "Main Pages" msgstr "Pàgines principals" -#: noindex-seo.php:3042 +#: noindex-seo.php:5283 msgid "Front Page" msgstr "Pàgina d'inici" -#: noindex-seo.php:3043 noindex-seo.php:3050 noindex-seo.php:3062 -#: noindex-seo.php:3068 noindex-seo.php:3075 noindex-seo.php:3081 -#: noindex-seo.php:3092 noindex-seo.php:3098 noindex-seo.php:3109 -#: noindex-seo.php:3115 noindex-seo.php:3121 noindex-seo.php:3127 -#: noindex-seo.php:3133 noindex-seo.php:3144 noindex-seo.php:3150 -#: noindex-seo.php:3156 noindex-seo.php:3167 noindex-seo.php:3178 -#: noindex-seo.php:3189 noindex-seo.php:3200 noindex-seo.php:3206 -#: noindex-seo.php:3217 noindex-seo.php:3241 noindex-seo.php:3519 +#: noindex-seo.php:5284 noindex-seo.php:5291 noindex-seo.php:5303 +#: noindex-seo.php:5309 noindex-seo.php:5316 noindex-seo.php:5322 +#: noindex-seo.php:5333 noindex-seo.php:5339 noindex-seo.php:5350 +#: noindex-seo.php:5356 noindex-seo.php:5362 noindex-seo.php:5368 +#: noindex-seo.php:5374 noindex-seo.php:5385 noindex-seo.php:5391 +#: noindex-seo.php:5397 noindex-seo.php:5408 noindex-seo.php:5419 +#: noindex-seo.php:5430 noindex-seo.php:5441 noindex-seo.php:5447 +#: noindex-seo.php:5458 noindex-seo.php:5482 noindex-seo.php:5523 +#: noindex-seo.php:5881 msgid "Recommended" msgstr "Recomanat" -#: noindex-seo.php:3045 +#: noindex-seo.php:5286 msgid "Block the indexing of the site's front page." msgstr "Bloqueja la indexació de la pàgina d'inici del lloc." -#: noindex-seo.php:3049 +#: noindex-seo.php:5290 msgid "Home" msgstr "Inici" -#: noindex-seo.php:3052 +#: noindex-seo.php:5293 msgid "Block the indexing of the site's home page." msgstr "Bloqueja la indexació de la pàgina principal del lloc." -#: noindex-seo.php:3058 +#: noindex-seo.php:5299 msgid "Pages and Posts" msgstr "Pàgines i entrades" -#: noindex-seo.php:3061 +#: noindex-seo.php:5302 msgid "Page" msgstr "Pàgina" -#: noindex-seo.php:3064 +#: noindex-seo.php:5305 msgid "Block the indexing of site pages." msgstr "Bloqueja la indexació de les pàgines del lloc." -#: noindex-seo.php:3067 +#: noindex-seo.php:5308 msgid "Privacy Policy" msgstr "Política de privadesa" -#: noindex-seo.php:3070 +#: noindex-seo.php:5311 msgid "Block the indexing of the privacy policy page." msgstr "Bloqueja la indexació de la pàgina de política de privadesa." -#: noindex-seo.php:3074 +#: noindex-seo.php:5315 msgid "Single Post" msgstr "Entrada individual" -#: noindex-seo.php:3077 +#: noindex-seo.php:5318 msgid "Block the indexing of individual posts." msgstr "Bloqueja la indexació d'entrades individuals." -#: noindex-seo.php:3080 +#: noindex-seo.php:5321 msgid "Singular" msgstr "Singular" -#: noindex-seo.php:3083 +#: noindex-seo.php:5324 msgid "Block the indexing of any singular content (post or page)." msgstr "" "Bloqueja la indexació de qualsevol contingut singular (entrada o pàgina)." +"Bloqueja la indexació de qualsevol contingut singular (entrada o pàgina)." -#: noindex-seo.php:3088 +#: noindex-seo.php:5329 msgid "Taxonomies" msgstr "Taxonomies" -#: noindex-seo.php:3091 +#: noindex-seo.php:5332 msgid "Category" msgstr "Categoria" -#: noindex-seo.php:3094 +#: noindex-seo.php:5335 msgid "Block the indexing of category archive pages." msgstr "Bloqueja la indexació de les pàgines d'arxiu de categories." -#: noindex-seo.php:3097 +#: noindex-seo.php:5338 msgid "Tag" msgstr "Etiqueta" -#: noindex-seo.php:3100 +#: noindex-seo.php:5341 msgid "Block the indexing of tag archive pages." msgstr "Bloqueja la indexació de les pàgines d'arxiu d'etiquetes." -#: noindex-seo.php:3105 +#: noindex-seo.php:5346 msgid "Date Archives" msgstr "Arxius de data" -#: noindex-seo.php:3108 +#: noindex-seo.php:5349 msgid "Date" msgstr "Data" -#: noindex-seo.php:3111 +#: noindex-seo.php:5352 msgid "Block the indexing of any date-based archive page." msgstr "Bloqueja la indexació de qualsevol pàgina d'arxiu basada en data." -#: noindex-seo.php:3114 +#: noindex-seo.php:5355 msgid "Day" msgstr "Dia" -#: noindex-seo.php:3117 +#: noindex-seo.php:5358 msgid "Block the indexing of daily archive pages." msgstr "Bloqueja la indexació d'arxius diaris." -#: noindex-seo.php:3120 +#: noindex-seo.php:5361 msgid "Month" msgstr "Mes" -#: noindex-seo.php:3123 +#: noindex-seo.php:5364 msgid "Block the indexing of monthly archive pages." msgstr "Bloqueja la indexació d'arxius mensuals." -#: noindex-seo.php:3126 +#: noindex-seo.php:5367 msgid "Time" msgstr "Hora" -#: noindex-seo.php:3129 +#: noindex-seo.php:5370 msgid "Block the indexing of time-based archive pages." msgstr "Bloqueja la indexació d'arxius basats en hora." -#: noindex-seo.php:3132 +#: noindex-seo.php:5373 msgid "Year" msgstr "Any" -#: noindex-seo.php:3135 +#: noindex-seo.php:5376 msgid "Block the indexing of yearly archive pages." msgstr "Bloqueja la indexació d'arxius anuals." -#: noindex-seo.php:3140 +#: noindex-seo.php:5381 msgid "Archives" msgstr "Arxius" -#: noindex-seo.php:3143 +#: noindex-seo.php:5384 msgid "Archive" msgstr "Arxiu" -#: noindex-seo.php:3146 +#: noindex-seo.php:5387 msgid "Block the indexing of any type of archive page." msgstr "Bloqueja la indexació de qualsevol tipus de pàgina d'arxiu." -#: noindex-seo.php:3149 +#: noindex-seo.php:5390 msgid "Author" msgstr "Autor" -#: noindex-seo.php:3152 +#: noindex-seo.php:5393 msgid "Block the indexing of author archive pages." msgstr "Bloqueja la indexació de les pàgines d'arxiu d'autor." -#: noindex-seo.php:3155 +#: noindex-seo.php:5396 msgid "Post Type Archive" msgstr "Arxiu de tipus de contingut" -#: noindex-seo.php:3158 +#: noindex-seo.php:5399 msgid "Block the indexing of post type archive pages." msgstr "Bloqueja la indexació de les pàgines d'arxiu de tipus de contingut." -#: noindex-seo.php:3163 +#: noindex-seo.php:5404 msgid "Pagination" msgstr "Paginació" -#: noindex-seo.php:3166 +#: noindex-seo.php:5407 msgid "Paginated Pages" msgstr "Pàgines paginades" -#: noindex-seo.php:3169 +#: noindex-seo.php:5410 msgid "Block the indexing of pagination pages (page 2, 3, etc.)." msgstr "Bloqueja la indexació de les pàgines de paginació (pàgina 2, 3, etc.)." -#: noindex-seo.php:3174 +#: noindex-seo.php:5415 msgid "Search" msgstr "Cerca" -#: noindex-seo.php:3177 +#: noindex-seo.php:5418 msgid "Search Results" msgstr "Resultats de cerca" -#: noindex-seo.php:3180 +#: noindex-seo.php:5421 msgid "Block the indexing of search result pages." msgstr "Bloqueja la indexació de les pàgines de resultats de cerca." -#: noindex-seo.php:3185 +#: noindex-seo.php:5426 msgid "Attachments" msgstr "Adjunts" -#: noindex-seo.php:3188 +#: noindex-seo.php:5429 msgid "Attachment Pages" msgstr "Pàgines d'adjunts" -#: noindex-seo.php:3191 +#: noindex-seo.php:5432 msgid "" "Block the indexing of attachment pages (does not affect the file itself)." msgstr "" "Bloqueja la indexació de les pàgines d'adjunts (no afecta el fitxer en si)." -#: noindex-seo.php:3196 +#: noindex-seo.php:5437 msgid "Previews" msgstr "Previsualitzacions" -#: noindex-seo.php:3199 +#: noindex-seo.php:5440 msgid "Customize Preview" msgstr "Previsualització del personalitzador" -#: noindex-seo.php:3202 +#: noindex-seo.php:5443 msgid "Block the indexing when content is in customize preview mode." msgstr "" -"Bloqueja la indexació quan el contingut és en mode de previsualització del " -"personalitzador." +"Bloqueja la indexació quan el contingut es mostra en mode de " +"previsualització del personalitzador.Bloqueja la indexació quan el contingut " +"és en mode de previsualització del personalitzador." -#: noindex-seo.php:3205 +#: noindex-seo.php:5446 msgid "Post Preview" msgstr "Previsualització de l'entrada" -#: noindex-seo.php:3208 +#: noindex-seo.php:5449 msgid "Block the indexing when viewing post previews." msgstr "Bloqueja la indexació en veure previsualitzacions d'entrades." -#: noindex-seo.php:3213 +#: noindex-seo.php:5454 msgid "Error Pages" msgstr "Pàgines d'error" -#: noindex-seo.php:3216 +#: noindex-seo.php:5457 msgid "Error 404" msgstr "Error 404" -#: noindex-seo.php:3219 +#: noindex-seo.php:5460 msgid "Block the indexing of 404 error pages." msgstr "Bloqueja la indexació de les pàgines d'error 404." #. translators: %s: post type singular name. -#: noindex-seo.php:3244 +#: noindex-seo.php:5485 #, php-format msgid "Block the indexing of individual %s." msgstr "Bloqueja la indexació de %s individuals." -#: noindex-seo.php:3248 +#: noindex-seo.php:5489 msgid "Custom Post Types" msgstr "Tipus de contingut personalitzats" -#: noindex-seo.php:3273 assets/js/editor-sidebar.js:142 -msgid "noindex" -msgstr "noindex" +#: noindex-seo.php:5502 +msgid "Cart" +msgstr "Cistella" -#: noindex-seo.php:3274 +#: noindex-seo.php:5503 +msgid "Block the indexing of the WooCommerce cart page." +msgstr "Bloqueja la indexació de la pàgina de la cistella del WooCommerce." + +#: noindex-seo.php:5506 +msgid "Checkout" +msgstr "Pagament" + +#: noindex-seo.php:5507 +msgid "Block the indexing of the WooCommerce checkout page." +msgstr "Bloqueja la indexació de la pàgina de pagament del WooCommerce." + +#: noindex-seo.php:5510 +msgid "My Account" +msgstr "El meu compte" + +#: noindex-seo.php:5511 +msgid "" +"Block the indexing of the WooCommerce customer account pages (including " +"order history and address endpoints)." +msgstr "" +"Bloqueja la indexació de les pàgines del compte de client del WooCommerce " +"(incloent-hi l'historial de comandes i les adreces)." + +#: noindex-seo.php:5531 +msgid "WooCommerce" +msgstr "WooCommerce" + +#: noindex-seo.php:5559 msgid "Prevent search engines from indexing this page" msgstr "Evita que els cercadors indexin aquesta pàgina" -#: noindex-seo.php:3278 assets/js/editor-sidebar.js:157 -msgid "nofollow" -msgstr "nofollow" - -#: noindex-seo.php:3279 +#: noindex-seo.php:5564 msgid "Prevent search engines from following links on this page" msgstr "Evita que els cercadors segueixin els enllaços en aquesta pàgina" -#: noindex-seo.php:3283 assets/js/editor-sidebar.js:172 -msgid "noarchive" -msgstr "noarchive" - -#: noindex-seo.php:3284 +#: noindex-seo.php:5569 msgid "Prevent search engines from showing a cached version" msgstr "Evita que els cercadors mostrin una versió en memòria cau" -#: noindex-seo.php:3288 assets/js/editor-sidebar.js:187 -msgid "nosnippet" -msgstr "nosnippet" - -#: noindex-seo.php:3289 +#: noindex-seo.php:5574 msgid "Prevent search engines from showing text snippets" msgstr "Evita que els cercadors mostrin fragments de text" -#: noindex-seo.php:3293 assets/js/editor-sidebar.js:202 -msgid "noimageindex" -msgstr "noimageindex" - -#: noindex-seo.php:3294 +#: noindex-seo.php:5579 msgid "Prevent search engines from indexing images" msgstr "Evita que els cercadors indexin imatges" -#: noindex-seo.php:3301 +#: noindex-seo.php:5584 +msgid "Ask search engines not to translate this page" +msgstr "Demaneu als cercadors que no tradueixin aquesta pàgina" + +#: noindex-seo.php:5604 +msgid "Stop indexing this page after this date and time" +msgstr "Deixa d'indexar aquesta pàgina a partir d'aquesta data i hora" + +#: noindex-seo.php:5611 msgid "noindex SEO Settings" msgstr "Ajustaments de noindex SEO" -#: noindex-seo.php:3302 +#: noindex-seo.php:5612 msgid "" "Control how search engines index and display your WordPress content using " "robots directives." @@ -536,71 +653,55 @@ msgstr "" "Controla com els cercadors indexen i mostren el vostre contingut de " "WordPress fent servir directrius robots." -#: noindex-seo.php:3313 +#: noindex-seo.php:5623 msgid "" "Recommended defaults applied. Review the changes below and click \"Save " "Changes\" to keep them, or uncheck anything you do not want." msgstr "" -"Valors recomanats aplicats. Reviseu els canvis de baix i feu clic a «Desa" -"els canvis» per a conservar-los, o desmarqueu el que no vulgueu." +"Valors recomanats aplicats. Reviseu els canvis de baix i feu clic a «Desaels " +"canvis» per a conservar-los, o desmarqueu el que no vulgueu." +#: noindex-seo.php:5631 +msgid "Settings imported successfully." +msgstr "S'han importat els ajustaments correctament." -#: noindex-seo.php:3329 -msgid "Apply Recommended Defaults" -msgstr "Aplica els valors recomanats" - -#: noindex-seo.php:3334 -msgid "Enable all directives for the 12 contexts flagged as recommended." -msgstr "Activa totes les directives en els 12 contextos marcats com a recomanats." - -#: noindex-seo.php:3339 +#: noindex-seo.php:5638 msgid "" -"Enables all 5 directives on the 12 contexts flagged \"Recommended\" (privacy " -"policy, date archives, pagination, search results, attachment pages, " -"previews, 404). Review and save." +"The settings file could not be imported: it is missing, too large, or not a " +"valid noindex SEO export." msgstr "" -"Activa les 5 directives en els 12 contextes marcats com a «Recomanat»" -"(política de privadesa, arxius de data, paginació, resultats de cerca," -"pàgines d'adjunts, previsualitzacions i 404). Reviseu i deseu." +"No s'ha pogut importar el fitxer d'ajustaments: no existeix, és massa gran o " +"no és una exportació vàlida de noindex SEO." +#: noindex-seo.php:5646 +msgid "Settings sections" +msgstr "Seccions dels ajustaments" -#: noindex-seo.php:3352 -msgid "Total Options" -msgstr "Opcions totals" - -#: noindex-seo.php:3356 -msgid "Enabled" -msgstr "Activades" - -#: noindex-seo.php:3360 -msgid "Recommended to Enable" -msgstr "Recomanades per a activar" - -#: noindex-seo.php:3368 +#: noindex-seo.php:5673 msgid "General Configuration" msgstr "Configuració general" -#: noindex-seo.php:3382 +#: noindex-seo.php:5687 msgid "Disable compatibility warnings with other SEO plugins" msgstr "Desactiva els avisos de compatibilitat amb altres complements de SEO" -#: noindex-seo.php:3389 +#: noindex-seo.php:5694 msgid "Implementation Method" msgstr "Mètode d'implementació" -#: noindex-seo.php:3397 +#: noindex-seo.php:5702 msgid "HTML Meta Tags (default, easier to verify)" msgstr "Etiquetes meta HTML (per defecte, més fàcil de comprovar)" -#: noindex-seo.php:3400 +#: noindex-seo.php:5705 msgid "HTTP Headers (more robust, works with PDFs/images)" msgstr "Capçaleres HTTP (més robust, funciona amb PDFs/imatges)" -#: noindex-seo.php:3403 +#: noindex-seo.php:5708 msgid "Both (maximum compatibility)" msgstr "Ambdós (màxima compatibilitat)" -#: noindex-seo.php:3407 +#: noindex-seo.php:5712 msgid "" "Choose how noindex directives are sent to search engines. Meta tags work for " "HTML pages. HTTP headers work for all content types including PDFs, images, " @@ -610,11 +711,11 @@ msgstr "" "funcionen per a pàgines HTML. Les capçaleres HTTP funcionen per a tots els " "tipus de contingut, incloent-hi PDFs, imatges i feeds." -#: noindex-seo.php:3425 +#: noindex-seo.php:5730 msgid "Enable per-post/page granular control" msgstr "Activa el control granular per entrada/pàgina" -#: noindex-seo.php:3428 +#: noindex-seo.php:5733 msgid "" "When enabled, a meta box will appear in the post/page editor allowing you to " "override global settings for individual content. Useful for specific pages " @@ -624,29 +725,28 @@ msgstr "" "permet sobreescriure els ajustaments globals per a contingut individual. " "Útil per a pàgines específiques que necessiten directrius robots diferents." -#: noindex-seo.php:3446 +#: noindex-seo.php:5751 msgid "Enable per-term granular control" msgstr "Activa el control granular per terme" -#: noindex-seo.php:3449 +#: noindex-seo.php:5754 msgid "" "When enabled, a \"Search Engine Visibility\" panel will appear on the Edit " "screen for every public taxonomy (categories, tags, and custom taxonomies " "like WooCommerce product categories). Useful for noindexing a specific " "category or tag without affecting the others." msgstr "" -"Quan s'activa, un panell «Visibilitat als cercadors» apareixerà a la" -"pantalla d'edició de totes les taxonomies públiques (categories, etiquetes i" -"taxonomies personalitzades com les categories de producte del WooCommerce)." -"És útil per a aplicar noindex a una categoria o etiqueta concreta sense" -"afectar les altres." +"Quan s'activa, un panell «Visibilitat als cercadors» apareixerà a lapantalla " +"d'edició de totes les taxonomies públiques (categories, etiquetes " +"itaxonomies personalitzades com les categories de producte del WooCommerce)." +"És útil per a aplicar noindex a una categoria o etiqueta concreta " +"senseafectar les altres." - -#: noindex-seo.php:3467 +#: noindex-seo.php:5772 msgid "Delete all plugin data on uninstall" msgstr "Suprimeix totes les dades del complement en desinstal·lar" -#: noindex-seo.php:3470 +#: noindex-seo.php:5775 msgid "" "When enabled, all settings and per-post robots directives will be " "permanently deleted when the plugin is uninstalled. By default data is " @@ -656,7 +756,52 @@ msgstr "" "suprimiran de forma permanent en desinstal·lar el complement. Per defecte, " "les dades es conserven." -#: noindex-seo.php:3479 +#: noindex-seo.php:5791 +msgid "Recommended settings" +msgstr "Ajustaments recomanats" + +#: noindex-seo.php:5793 +msgid "" +"Enables all 5 directives on the 15 contexts flagged \"Recommended\" (privacy " +"policy, date archives, pagination, search results, attachment pages, " +"previews, 404, WooCommerce cart / checkout / my account). Review and save." +msgstr "" +"Activa les 5 directives en els 15 contextes marcats com a " +"«Recomanat»(política de privadesa, arxius de data, paginació, resultats de " +"cerca,pàgines d'adjunts, previsualitzacions, 404 i cistella, pagament i " +"compte del WooCommerce). Reviseu i deseu." + +#: noindex-seo.php:5800 +msgid "Apply Recommended Defaults" +msgstr "Aplica els valors recomanats" + +#: noindex-seo.php:5805 +msgid "Enable all directives for the 15 contexts flagged as recommended." +msgstr "" +"Activa totes les directives dels 15 contextos marcats com a recomanats." +"Activa totes les directives en els 15 contextos marcats com a recomanats." + +#: noindex-seo.php:5819 +msgid "Overview" +msgstr "Resum" + +#: noindex-seo.php:5823 +msgid "Total Options" +msgstr "Opcions totals" + +#: noindex-seo.php:5827 +msgid "Enabled" +msgstr "Activades" + +#: noindex-seo.php:5831 +msgid "Recommended to Enable" +msgstr "Recomanades per a activar" + +#: noindex-seo.php:5836 +msgid "Page contexts" +msgstr "Contextos de pàgina" + +#: noindex-seo.php:5841 msgid "" "Important: Enabling noindex on the wrong pages can harm your search engine " "rankings. Only enable options you fully understand." @@ -665,53 +810,263 @@ msgstr "" "vostre posicionament als cercadors. Activeu només les opcions que enteneu " "completament." -#: noindex-seo.php:3486 +#: noindex-seo.php:5848 msgid "Search options..." msgstr "Cerca opcions…" -#: noindex-seo.php:3487 +#: noindex-seo.php:5849 msgid "Search options" msgstr "Cerca opcions" -#: noindex-seo.php:3512 +#: noindex-seo.php:5874 msgid "This option only works with HTTP Headers implementation method" msgstr "" -"Aquesta opció només funciona amb el mètode d'implementació de capçaleres HTTP" +"Aquesta opció només funciona amb el mètode d'implementació de capçaleres " +"HTTPAquesta opció només funciona amb el mètode d'implementació de capçaleres " +"HTTP" -#: noindex-seo.php:3521 +#: noindex-seo.php:5883 msgid "Not Recommended" msgstr "No recomanat" -#: noindex-seo.php:3526 +#: noindex-seo.php:5888 msgid "View Page" msgstr "Mostra la pàgina" -#: assets/js/editor-sidebar.js:103 +#: noindex-seo.php:5969 noindex-seo.php:5977 +msgid "Conditional rules" +msgstr "Regles condicionals" + +#: noindex-seo.php:5971 +msgid "" +"Automatically apply noindex to any post whose custom field (for example an " +"ACF field) exactly matches a value. Rules run below the per-post overrides " +"and above the global context settings, and matched posts drop out of the XML " +"sitemap." +msgstr "" +"Apliqueu automàticament noindex a qualsevol entrada el camp personalitzat de " +"la qual (per exemple, un camp d'ACF) coincideixi exactament amb un valor. " +"Les regles s'executen per sota dels ajustos individuals de cada entrada i " +"per sobre dels ajustos globals de context, i les entrades coincidents " +"desapareixen del mapa del lloc XML." + +#: noindex-seo.php:5984 +msgid "Field name" +msgstr "Nom del camp" + +#: noindex-seo.php:5985 +msgid "Value" +msgstr "Valor" + +#: noindex-seo.php:5986 noindex-seo.php:6210 +msgid "Actions" +msgstr "Accions" + +#: noindex-seo.php:6002 +msgid "custom_field_name" +msgstr "nom_del_camp_personalitzat" + +#: noindex-seo.php:6003 +msgid "value that triggers noindex" +msgstr "valor que activa noindex" + +#: noindex-seo.php:6004 noindex-seo.php:6231 +msgid "Remove rule" +msgstr "Suprimeix la regla" + +#: noindex-seo.php:6009 noindex-seo.php:6236 +msgid "Add rule" +msgstr "Afegeix una regla" + +#: noindex-seo.php:6010 +msgid "Up to 20 rules. Rows with an empty field or value are ignored." +msgstr "Fins a 20 regles. Les files amb un camp o un valor buits s'ignoren." + +#. translators: %d: number of posts. +#: noindex-seo.php:6036 +#, php-format +msgid "Imported robots overrides for %d post" +msgid_plural "Imported robots overrides for %d posts" +msgstr[0] "S'han importat ajustos robots per a %d entrada" +msgstr[1] "S'han importat ajustos robots per a %d entrades" + +#. translators: %d: number of terms. +#. translators: %d: number of terms found. +#: noindex-seo.php:6041 noindex-seo.php:6105 +#, php-format +msgid "%d term" +msgid_plural "%d terms" +msgstr[0] "%d terme" +msgstr[1] "%d termes" + +#. translators: 1: number of skipped posts, 2: number of skipped terms. +#: noindex-seo.php:6052 +#, php-format +msgid "%1$d posts and %2$d terms skipped (already configured)" +msgstr "%1$d entrades i %2$d termes omesos (ja estaven configurats)" + +#: noindex-seo.php:6062 +msgid "No plugins were selected to import from." +msgstr "No s'ha seleccionat cap complement del qual importar." + +#: noindex-seo.php:6067 +msgid "The selected plugins had no importable robots data left." +msgstr "Els complements seleccionats no tenien cap dada robots importable." + +#: noindex-seo.php:6073 +msgid "Import from other plugins" +msgstr "Importa d'altres complements" + +#: noindex-seo.php:6075 +msgid "" +"Imports the noindex and nofollow flags stored by other SEO plugins (Yoast " +"SEO, Rank Math, SEOPress, All in One SEO) as per-post and per-term " +"overrides. Nothing is imported automatically: you pick the plugins below and " +"confirm. Content that already has its own override is never touched." +msgstr "" +"Importa els ajustos noindex i nofollow desats per altres complements de SEO " +"(Yoast SEO, Rank Math, SEOPress, All in One SEO) com a substitucions per " +"entrada i per terme. No s'importa res automàticament: trieu els complements " +"de sota i confirmeu-ho. El contingut que ja tingui la seva pròpia " +"substitució no es toca." + +#. translators: %d: number of posts found. +#: noindex-seo.php:6094 +#, php-format +msgid "%d post" +msgid_plural "%d posts" +msgstr[0] "%d entrada" +msgstr[1] "%d entrades" + +#: noindex-seo.php:6116 +msgid "" +"No importable robots data from other SEO plugins was found on this site." +msgstr "" +"No s'han trobat dades robots importables d'altres complements de SEO en " +"aquest lloc." + +#: noindex-seo.php:6120 +msgid "Import selected plugins" +msgstr "Importa els complements seleccionats" + +#: noindex-seo.php:6130 noindex-seo.php:6139 +msgid "Export settings" +msgstr "Exporta els ajustaments" + +#: noindex-seo.php:6132 +msgid "Download the current settings as a JSON file." +msgstr "Baixa els ajustaments actuals en un fitxer JSON." + +#: noindex-seo.php:6148 noindex-seo.php:6156 noindex-seo.php:6166 +msgid "Import settings" +msgstr "Importa els ajustaments" + +#: noindex-seo.php:6150 +msgid "" +"Restore the global settings from a previously exported JSON file. Per-post " +"and per-term overrides are kept." +msgstr "" +"Restaura els ajustaments globals des d'un fitxer JSON exportat anteriorment. " +"Les sobreescriptures per entrada i per terme es conserven." + +#: noindex-seo.php:6198 +msgid "Extend the virtual robots.txt with bot rules" +msgstr "Amplia el robots.txt virtual amb regles per a bots" + +#: noindex-seo.php:6201 +msgid "" +"Inactive by default. When enabled, the rules below are appended to the " +"robots.txt that WordPress generates virtually — they never replace it. This " +"only applies when WordPress serves robots.txt itself: a physical robots.txt " +"file in the site root, or \"Discourage search engines\" in Reading settings, " +"takes precedence." +msgstr "" +"Inactiu per defecte. En activar-lo, les regles de sota s'afegeixen al final " +"del robots.txt que el WordPress genera virtualment; mai no el substitueixen. " +"Només s'aplica quan el WordPress serveix el robots.txt ell mateix: un fitxer " +"robots.txt físic a l'arrel del lloc o l'opció «Desaconsella els cercadors» " +"als Ajustos de lectura tenen prioritat." + +#: noindex-seo.php:6208 +msgid "User-agent" +msgstr "User-agent" + +#: noindex-seo.php:6209 +msgid "Policy" +msgstr "Política" + +#: noindex-seo.php:6226 +msgid "User-agent token, e.g. GPTBot or *" +msgstr "Token de user-agent, per exemple GPTBot o *" + +#: noindex-seo.php:6228 +msgid "Block (Disallow: /)" +msgstr "Bloqueja (Disallow: /)" + +#: noindex-seo.php:6229 +msgid "Allow (Allow: /)" +msgstr "Permet (Allow: /)" + +#: noindex-seo.php:6237 +msgid "Add common AI bots" +msgstr "Afegeix bots d'IA habituals" + +#: noindex-seo.php:6238 +msgid "Add common search engine bots" +msgstr "Afegeix bots de cercadors habituals" + +#: noindex-seo.php:6241 +msgid "" +"Up to 30 rules. Blocked bots receive \"Disallow: /\" for the whole site; " +"allowed bots receive \"Allow: /\" (useful to allow one crawler inside a " +"broader block set with a * rule). Duplicate user-agents are ignored." +msgstr "" +"Fins a 30 regles. Els bots bloquejats reben «Disallow: /» per a tot el lloc; " +"els permesos reben «Allow: /» (útil per a permetre un rastrejador dins d'un " +"bloqueig més ampli definit amb *). Els user-agent duplicats s'ignoren." + +#: noindex-seo.php:6247 +msgid "Preview of the appended block" +msgstr "Previsualització del bloc afegit" + +#: assets/js/editor-sidebar.js:188 msgid "Enable to set custom robots directives for this content" msgstr "" -"Activeu per a establir directrius robots personalitzades per a aquest " -"contingut" +"Activeu-la per a definir directives robots personalitzades per a aquest " +"contingutActiveu per a establir directrius robots personalitzades per a " +"aquest contingut" -#: assets/js/editor-sidebar.js:133 +#: assets/js/editor-sidebar.js:218 msgid "Robots Directives:" msgstr "Directrius robots:" -#: assets/js/editor-sidebar.js:143 -msgid "Prevent search engines from indexing" -msgstr "Evita que els cercadors indexin" - -#: assets/js/editor-sidebar.js:158 -msgid "Prevent search engines from following links" -msgstr "Evita que els cercadors segueixin els enllaços" - -#: assets/js/editor-sidebar.js:173 -msgid "Prevent cached versions in search results" -msgstr "Evita versions en memòria cau als resultats de cerca" - -#: assets/js/editor-sidebar.js:188 -msgid "Prevent text snippets in search results" -msgstr "Evita fragments de text als resultats de cerca" - -#: assets/js/editor-sidebar.js:237 +#: assets/js/editor-sidebar.js:249 msgid "Active Directives:" msgstr "Directrius actives:" + +#~ msgid "Prevent search engines from indexing" +#~ msgstr "Evita que els cercadors indexin" + +#~ msgid "Prevent search engines from following links" +#~ msgstr "Evita que els cercadors segueixin els enllaços" + +#~ msgid "Prevent cached versions in search results" +#~ msgstr "Evita versions en memòria cau als resultats de cerca" + +#~ msgid "Prevent text snippets in search results" +#~ msgstr "Evita fragments de text als resultats de cerca" + +#~ msgid "🔍 noindex" +#~ msgstr "🔍 noindex" + +#~ msgid "🔗 nofollow" +#~ msgstr "🔗 nofollow" + +#~ msgid "💾 noarchive" +#~ msgstr "💾 noarchive" + +#~ msgid "📄 nosnippet" +#~ msgstr "📄 nosnippet" + +#~ msgid "🖼️ noimageindex" +#~ msgstr "🖼️ noimageindex" diff --git a/languages/noindex-seo-es_ES.mo b/languages/noindex-seo-es_ES.mo index 718993f..81b1b84 100644 Binary files a/languages/noindex-seo-es_ES.mo and b/languages/noindex-seo-es_ES.mo differ diff --git a/languages/noindex-seo-es_ES.po b/languages/noindex-seo-es_ES.po index a239e91..b939829 100644 --- a/languages/noindex-seo-es_ES.po +++ b/languages/noindex-seo-es_ES.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: noindex SEO 3.1.3\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/noindex-seo\n" -"POT-Creation-Date: 2026-08-17T19:24:59+00:00\n" +"POT-Creation-Date: 2026-11-03T20:17:27+00:00\n" "PO-Revision-Date: 2026-08-17T20:00+00:00\n" "Last-Translator: ROBOTSTXT \n" "Language-Team: Spanish (Spain) — https://translate.wordpress.org/locale/es/" @@ -19,7 +19,7 @@ msgstr "" "X-Domain: noindex-seo\n" #. Plugin Name of the plugin -#: noindex-seo.php noindex-seo.php:1405 noindex-seo.php:1406 +#: noindex-seo.php noindex-seo.php:2590 noindex-seo.php:2591 msgid "noindex SEO" msgstr "noindex SEO" @@ -49,40 +49,40 @@ msgstr "ROBOTSTXT" msgid "https://www.robotstxt.software/" msgstr "https://www.robotstxt.software/" -#: noindex-seo.php:1036 +#: noindex-seo.php:1993 msgid "Post ID to compute effective directives for." msgstr "ID de la entrada para calcular las directivas efectivas." -#: noindex-seo.php:1065 +#: noindex-seo.php:2020 msgid "You do not have permission to read the noindex SEO settings." msgstr "No tienes permiso para leer los ajustes de noindex SEO." -#: noindex-seo.php:1118 +#: noindex-seo.php:2070 msgid "You do not have permission to read directives for this post." msgstr "No tienes permiso para leer las directivas de esta entrada." -#: noindex-seo.php:1176 +#: noindex-seo.php:2133 msgid "No post exists with that post_id." msgstr "No existe ninguna entrada con ese post_id." -#: noindex-seo.php:1301 +#: noindex-seo.php:2439 msgid "Settings saved successfully!" msgstr "¡Ajustes guardados correctamente!" -#: noindex-seo.php:1302 +#: noindex-seo.php:2440 msgid "Expand All" msgstr "Expandir todo" -#: noindex-seo.php:1303 +#: noindex-seo.php:2441 msgid "Collapse All" msgstr "Contraer todo" -#: noindex-seo.php:1385 +#: noindex-seo.php:2523 msgid "Settings" msgstr "Ajustes" #. translators: plugin name. -#: noindex-seo.php:1627 +#: noindex-seo.php:2816 #, php-format msgid "" "noindex SEO has detected that %s is active. This may cause conflicts. Please " @@ -91,19 +91,32 @@ msgstr "" "noindex SEO ha detectado que %s está activo. Esto puede causar conflictos. " "Configura las opciones en consecuencia." -#: noindex-seo.php:1657 noindex-seo.php:1756 -msgid "Permission denied or invalid nonce." -msgstr "Permiso denegado o nonce no válido." +#. translators: %s: comma-separated list of wp_robots callbacks. +#: noindex-seo.php:2837 +#, php-format +msgid "" +"noindex SEO has detected that another plugin or theme is adding robots " +"directives through the wp_robots API (%s). This may cause conflicts. Please " +"configure the options accordingly." +msgstr "" +"noindex SEO ha detectado que otro plugin o tema está añadiendo directivas de " +"robots mediante la API wp_robots (%s). Esto puede causar conflictos. " +"Configura las opciones en consecuencia." -#: noindex-seo.php:1914 noindex-seo.php:2238 assets/js/editor-sidebar.js:91 +#: noindex-seo.php:2954 noindex-seo.php:3129 noindex-seo.php:3180 +#: noindex-seo.php:3284 noindex-seo.php:3345 +msgid "Permission denied." +msgstr "Permiso denegado." + +#: noindex-seo.php:4033 noindex-seo.php:4422 assets/js/editor-sidebar.js:176 msgid "Search Engine Visibility" msgstr "Visibilidad en buscadores" -#: noindex-seo.php:1966 noindex-seo.php:2597 assets/js/editor-sidebar.js:102 +#: noindex-seo.php:4094 noindex-seo.php:4792 assets/js/editor-sidebar.js:187 msgid "Override global settings" msgstr "Sobrescribir ajustes globales" -#: noindex-seo.php:1971 +#: noindex-seo.php:4099 msgid "" "When enabled, these directives will override the global settings for this " "specific content." @@ -111,104 +124,169 @@ msgstr "" "Al activarse, estas directivas sobrescribirán los ajustes globales para este " "contenido específico." -#: noindex-seo.php:1978 +#: noindex-seo.php:4106 msgid "Prevent indexing" msgstr "Evitar indexación" -#: noindex-seo.php:1983 +#: noindex-seo.php:4111 msgid "Prevent link following" msgstr "Evitar seguimiento de enlaces" -#: noindex-seo.php:1988 +#: noindex-seo.php:4116 msgid "Prevent caching" msgstr "Evitar caché" -#: noindex-seo.php:1993 +#: noindex-seo.php:4121 msgid "Prevent snippets" msgstr "Evitar snippets" -#: noindex-seo.php:1998 assets/js/editor-sidebar.js:203 +#: noindex-seo.php:4126 msgid "Prevent image indexing" msgstr "Evitar indexación de imágenes" -#: noindex-seo.php:2006 +#: noindex-seo.php:4131 +msgid "Prevent translation" +msgstr "Evitar la traducción" + +#: noindex-seo.php:4136 +msgid "Value directives (empty = off):" +msgstr "Directivas con valor (vacío = desactivado):" + +#: noindex-seo.php:4139 noindex-seo.php:4145 noindex-seo.php:4154 +#: noindex-seo.php:4441 noindex-seo.php:4449 noindex-seo.php:4826 +#: noindex-seo.php:4831 noindex-seo.php:4839 noindex-seo.php:5923 +#: noindex-seo.php:5939 assets/js/editor-sidebar.js:141 +msgid "Off" +msgstr "Desactivado" + +#: noindex-seo.php:4140 noindex-seo.php:5589 +msgid "Maximum snippet length in characters (-1 = no limit)" +msgstr "Longitud máxima del fragmento en caracteres (-1 = sin límite)" + +#: noindex-seo.php:4146 noindex-seo.php:4442 noindex-seo.php:4832 +#: noindex-seo.php:5940 assets/js/editor-sidebar.js:142 +msgid "none" +msgstr "ninguna" + +#: noindex-seo.php:4147 noindex-seo.php:4443 noindex-seo.php:4833 +#: noindex-seo.php:5941 assets/js/editor-sidebar.js:143 +msgid "standard" +msgstr "estándar" + +#: noindex-seo.php:4148 noindex-seo.php:4444 noindex-seo.php:4834 +#: noindex-seo.php:5942 assets/js/editor-sidebar.js:144 +msgid "large" +msgstr "grande" + +#: noindex-seo.php:4150 noindex-seo.php:5594 +msgid "Maximum image preview size" +msgstr "Tamaño máximo de la vista previa de imágenes" + +#: noindex-seo.php:4155 noindex-seo.php:5599 +msgid "Maximum video preview seconds (-1 = no limit)" +msgstr "Segundos máximos de la vista previa de vídeo (-1 = sin límite)" + +#: noindex-seo.php:4160 +msgid "Stop indexing after this date and time" +msgstr "Dejar de indexar tras esta fecha y hora" + +#: noindex-seo.php:4168 msgid "Effective Directives:" msgstr "Directivas efectivas:" -#: noindex-seo.php:2031 +#: noindex-seo.php:4178 msgid "Override active:" msgstr "Sobrescritura activa:" -#: noindex-seo.php:2036 +#: noindex-seo.php:4183 msgid "Override enabled but no directives selected" msgstr "Sobrescritura activada pero sin directivas seleccionadas" -#: noindex-seo.php:2042 +#: noindex-seo.php:4189 msgid "Global settings:" msgstr "Ajustes globales:" -#: noindex-seo.php:2047 +#: noindex-seo.php:4194 msgid "No restrictions (indexable)" msgstr "Sin restricciones (indexable)" -#: noindex-seo.php:2242 +#: noindex-seo.php:4426 msgid "Override global settings for this term" msgstr "Sobrescribir los ajustes globales para este término" -#: noindex-seo.php:2255 +#: noindex-seo.php:4457 msgid "" "When override is enabled, the directives checked above apply to this term's " "archive page and take precedence over the global category / tag / archive " "settings." msgstr "" -"Cuando está activada la opción de sobrescribir, las directivas marcadas" -"arriba se aplican a la página de archivo de este término y prevalecen sobre" -"los ajustes globales de categorías, etiquetas y archivos." +"Cuando está activada la opción de sobrescribir, las directivas " +"marcadasarriba se aplican a la página de archivo de este término y " +"prevalecen sobrelos ajustes globales de categorías, etiquetas y archivos." - -#: noindex-seo.php:2350 noindex-seo.php:2356 noindex-seo.php:2488 -#: noindex-seo.php:2494 +#: noindex-seo.php:4559 noindex-seo.php:4565 noindex-seo.php:4681 +#: noindex-seo.php:4687 msgid "Robots" msgstr "Robots" -#: noindex-seo.php:2417 noindex-seo.php:2543 +#: noindex-seo.php:4623 noindex-seo.php:4742 msgid "Override (none)" msgstr "Sobrescritura (ninguna)" -#: noindex-seo.php:2593 +#: noindex-seo.php:4788 msgid "Robots Directives" msgstr "Directivas Robots" -#: noindex-seo.php:2602 -msgid "🔍 noindex" -msgstr "🔍 noindex" +#: noindex-seo.php:4798 noindex-seo.php:5558 +msgid "noindex" +msgstr "noindex" -#: noindex-seo.php:2606 -msgid "🔗 nofollow" -msgstr "🔗 nofollow" +#: noindex-seo.php:4803 noindex-seo.php:5563 +msgid "nofollow" +msgstr "nofollow" -#: noindex-seo.php:2610 -msgid "💾 noarchive" -msgstr "💾 noarchive" +#: noindex-seo.php:4808 noindex-seo.php:5568 +msgid "noarchive" +msgstr "noarchive" -#: noindex-seo.php:2614 -msgid "📄 nosnippet" -msgstr "📄 nosnippet" +#: noindex-seo.php:4813 noindex-seo.php:5573 +msgid "nosnippet" +msgstr "nosnippet" -#: noindex-seo.php:2618 -msgid "🖼️ noimageindex" -msgstr "🖼️ noimageindex" +#: noindex-seo.php:4818 noindex-seo.php:5578 +msgid "noimageindex" +msgstr "noimageindex" -#: noindex-seo.php:2729 +#: noindex-seo.php:4823 noindex-seo.php:5583 +msgid "notranslate" +msgstr "notranslate" + +#: noindex-seo.php:4827 noindex-seo.php:5588 +msgid "max-snippet" +msgstr "max-snippet" + +#: noindex-seo.php:4836 noindex-seo.php:5593 +msgid "max-image-preview" +msgstr "max-image-preview" + +#: noindex-seo.php:4840 noindex-seo.php:5598 +msgid "max-video-preview" +msgstr "max-video-preview" + +#: noindex-seo.php:4844 noindex-seo.php:5603 +msgid "unavailable_after" +msgstr "unavailable_after" + +#: noindex-seo.php:4957 msgid "Enable Robots Override" msgstr "Activar sobrescritura Robots" -#: noindex-seo.php:2730 +#: noindex-seo.php:4958 msgid "Disable Robots Override" msgstr "Desactivar sobrescritura Robots" #. translators: %d: Number of posts updated -#: noindex-seo.php:2827 +#: noindex-seo.php:5050 #, php-format msgid "Robots override enabled for %d post." msgid_plural "Robots override enabled for %d posts." @@ -216,323 +294,363 @@ msgstr[0] "Sobrescritura Robots activada para %d entrada." msgstr[1] "Sobrescritura Robots activada para %d entradas." #. translators: %d: Number of posts updated -#: noindex-seo.php:2848 +#: noindex-seo.php:5071 #, php-format msgid "Robots override disabled for %d post." msgid_plural "Robots override disabled for %d posts." msgstr[0] "Sobrescritura Robots desactivada para %d entrada." msgstr[1] "Sobrescritura Robots desactivada para %d entradas." -#: noindex-seo.php:2897 +#: noindex-seo.php:5120 msgid "All robots settings" msgstr "Todos los ajustes robots" -#: noindex-seo.php:2899 +#: noindex-seo.php:5122 msgid "With override" msgstr "Con sobrescritura" -#: noindex-seo.php:2902 +#: noindex-seo.php:5125 msgid "Without override" msgstr "Sin sobrescritura" -#: noindex-seo.php:3016 +#: noindex-seo.php:5244 msgid "You do not have sufficient permissions to access this page." msgstr "No tienes permisos suficientes para acceder a esta página." -#: noindex-seo.php:3017 +#: noindex-seo.php:5245 msgid "Permission Denied" msgstr "Permiso denegado" -#: noindex-seo.php:3039 +#: noindex-seo.php:5257 +msgid "General" +msgstr "General" + +#: noindex-seo.php:5258 +msgid "SEO Settings" +msgstr "Ajustes SEO" + +#: noindex-seo.php:5259 +msgid "Import / Export" +msgstr "Importación y exportación" + +#: noindex-seo.php:5260 +msgid "Robots.txt" +msgstr "Robots.txt" + +#: noindex-seo.php:5280 msgid "Main Pages" msgstr "Páginas principales" -#: noindex-seo.php:3042 +#: noindex-seo.php:5283 msgid "Front Page" msgstr "Página de inicio" -#: noindex-seo.php:3043 noindex-seo.php:3050 noindex-seo.php:3062 -#: noindex-seo.php:3068 noindex-seo.php:3075 noindex-seo.php:3081 -#: noindex-seo.php:3092 noindex-seo.php:3098 noindex-seo.php:3109 -#: noindex-seo.php:3115 noindex-seo.php:3121 noindex-seo.php:3127 -#: noindex-seo.php:3133 noindex-seo.php:3144 noindex-seo.php:3150 -#: noindex-seo.php:3156 noindex-seo.php:3167 noindex-seo.php:3178 -#: noindex-seo.php:3189 noindex-seo.php:3200 noindex-seo.php:3206 -#: noindex-seo.php:3217 noindex-seo.php:3241 noindex-seo.php:3519 +#: noindex-seo.php:5284 noindex-seo.php:5291 noindex-seo.php:5303 +#: noindex-seo.php:5309 noindex-seo.php:5316 noindex-seo.php:5322 +#: noindex-seo.php:5333 noindex-seo.php:5339 noindex-seo.php:5350 +#: noindex-seo.php:5356 noindex-seo.php:5362 noindex-seo.php:5368 +#: noindex-seo.php:5374 noindex-seo.php:5385 noindex-seo.php:5391 +#: noindex-seo.php:5397 noindex-seo.php:5408 noindex-seo.php:5419 +#: noindex-seo.php:5430 noindex-seo.php:5441 noindex-seo.php:5447 +#: noindex-seo.php:5458 noindex-seo.php:5482 noindex-seo.php:5523 +#: noindex-seo.php:5881 msgid "Recommended" msgstr "Recomendado" -#: noindex-seo.php:3045 +#: noindex-seo.php:5286 msgid "Block the indexing of the site's front page." msgstr "Bloquear la indexación de la página de inicio del sitio." -#: noindex-seo.php:3049 +#: noindex-seo.php:5290 msgid "Home" msgstr "Inicio" -#: noindex-seo.php:3052 +#: noindex-seo.php:5293 msgid "Block the indexing of the site's home page." msgstr "Bloquear la indexación de la página principal del sitio." -#: noindex-seo.php:3058 +#: noindex-seo.php:5299 msgid "Pages and Posts" msgstr "Páginas y entradas" -#: noindex-seo.php:3061 +#: noindex-seo.php:5302 msgid "Page" msgstr "Página" -#: noindex-seo.php:3064 +#: noindex-seo.php:5305 msgid "Block the indexing of site pages." msgstr "Bloquear la indexación de las páginas del sitio." -#: noindex-seo.php:3067 +#: noindex-seo.php:5308 msgid "Privacy Policy" msgstr "Política de privacidad" -#: noindex-seo.php:3070 +#: noindex-seo.php:5311 msgid "Block the indexing of the privacy policy page." msgstr "Bloquear la indexación de la página de política de privacidad." -#: noindex-seo.php:3074 +#: noindex-seo.php:5315 msgid "Single Post" msgstr "Entrada individual" -#: noindex-seo.php:3077 +#: noindex-seo.php:5318 msgid "Block the indexing of individual posts." msgstr "Bloquear la indexación de entradas individuales." -#: noindex-seo.php:3080 +#: noindex-seo.php:5321 msgid "Singular" msgstr "Singular" -#: noindex-seo.php:3083 +#: noindex-seo.php:5324 msgid "Block the indexing of any singular content (post or page)." msgstr "" "Bloquear la indexación de cualquier contenido singular (entrada o página)." +"Bloquear la indexación de cualquier contenido singular (entrada o página)." -#: noindex-seo.php:3088 +#: noindex-seo.php:5329 msgid "Taxonomies" msgstr "Taxonomías" -#: noindex-seo.php:3091 +#: noindex-seo.php:5332 msgid "Category" msgstr "Categoría" -#: noindex-seo.php:3094 +#: noindex-seo.php:5335 msgid "Block the indexing of category archive pages." msgstr "Bloquear la indexación de las páginas de archivo de categorías." -#: noindex-seo.php:3097 +#: noindex-seo.php:5338 msgid "Tag" msgstr "Etiqueta" -#: noindex-seo.php:3100 +#: noindex-seo.php:5341 msgid "Block the indexing of tag archive pages." msgstr "Bloquear la indexación de las páginas de archivo de etiquetas." -#: noindex-seo.php:3105 +#: noindex-seo.php:5346 msgid "Date Archives" msgstr "Archivos de fecha" -#: noindex-seo.php:3108 +#: noindex-seo.php:5349 msgid "Date" msgstr "Fecha" -#: noindex-seo.php:3111 +#: noindex-seo.php:5352 msgid "Block the indexing of any date-based archive page." msgstr "Bloquear la indexación de cualquier página de archivo basada en fecha." -#: noindex-seo.php:3114 +#: noindex-seo.php:5355 msgid "Day" msgstr "Día" -#: noindex-seo.php:3117 +#: noindex-seo.php:5358 msgid "Block the indexing of daily archive pages." msgstr "Bloquear la indexación de archivos diarios." -#: noindex-seo.php:3120 +#: noindex-seo.php:5361 msgid "Month" msgstr "Mes" -#: noindex-seo.php:3123 +#: noindex-seo.php:5364 msgid "Block the indexing of monthly archive pages." msgstr "Bloquear la indexación de archivos mensuales." -#: noindex-seo.php:3126 +#: noindex-seo.php:5367 msgid "Time" msgstr "Hora" -#: noindex-seo.php:3129 +#: noindex-seo.php:5370 msgid "Block the indexing of time-based archive pages." msgstr "Bloquear la indexación de archivos basados en hora." -#: noindex-seo.php:3132 +#: noindex-seo.php:5373 msgid "Year" msgstr "Año" -#: noindex-seo.php:3135 +#: noindex-seo.php:5376 msgid "Block the indexing of yearly archive pages." msgstr "Bloquear la indexación de archivos anuales." -#: noindex-seo.php:3140 +#: noindex-seo.php:5381 msgid "Archives" msgstr "Archivos" -#: noindex-seo.php:3143 +#: noindex-seo.php:5384 msgid "Archive" msgstr "Archivo" -#: noindex-seo.php:3146 +#: noindex-seo.php:5387 msgid "Block the indexing of any type of archive page." msgstr "Bloquear la indexación de cualquier tipo de página de archivo." -#: noindex-seo.php:3149 +#: noindex-seo.php:5390 msgid "Author" msgstr "Autor" -#: noindex-seo.php:3152 +#: noindex-seo.php:5393 msgid "Block the indexing of author archive pages." msgstr "Bloquear la indexación de las páginas de archivo de autor." -#: noindex-seo.php:3155 +#: noindex-seo.php:5396 msgid "Post Type Archive" msgstr "Archivo de tipo de contenido" -#: noindex-seo.php:3158 +#: noindex-seo.php:5399 msgid "Block the indexing of post type archive pages." msgstr "" "Bloquear la indexación de las páginas de archivo de tipos de contenido." -#: noindex-seo.php:3163 +#: noindex-seo.php:5404 msgid "Pagination" msgstr "Paginación" -#: noindex-seo.php:3166 +#: noindex-seo.php:5407 msgid "Paginated Pages" msgstr "Páginas paginadas" -#: noindex-seo.php:3169 +#: noindex-seo.php:5410 msgid "Block the indexing of pagination pages (page 2, 3, etc.)." msgstr "" "Bloquear la indexación de las páginas de paginación (página 2, 3, etc.)." -#: noindex-seo.php:3174 +#: noindex-seo.php:5415 msgid "Search" msgstr "Buscar" -#: noindex-seo.php:3177 +#: noindex-seo.php:5418 msgid "Search Results" msgstr "Resultados de búsqueda" -#: noindex-seo.php:3180 +#: noindex-seo.php:5421 msgid "Block the indexing of search result pages." msgstr "Bloquear la indexación de las páginas de resultados de búsqueda." -#: noindex-seo.php:3185 +#: noindex-seo.php:5426 msgid "Attachments" msgstr "Adjuntos" -#: noindex-seo.php:3188 +#: noindex-seo.php:5429 msgid "Attachment Pages" msgstr "Páginas de adjuntos" -#: noindex-seo.php:3191 +#: noindex-seo.php:5432 msgid "" "Block the indexing of attachment pages (does not affect the file itself)." msgstr "" "Bloquear la indexación de las páginas de adjuntos (no afecta al archivo en " "sí)." -#: noindex-seo.php:3196 +#: noindex-seo.php:5437 msgid "Previews" msgstr "Vistas previas" -#: noindex-seo.php:3199 +#: noindex-seo.php:5440 msgid "Customize Preview" msgstr "Vista previa del personalizador" -#: noindex-seo.php:3202 +#: noindex-seo.php:5443 msgid "Block the indexing when content is in customize preview mode." msgstr "" -"Bloquear la indexación cuando el contenido está en modo de vista previa del " -"personalizador." +"Bloquear la indexación cuando el contenido se muestra en modo de vista " +"previa del personalizador.Bloquear la indexación cuando el contenido está en " +"modo de vista previa del personalizador." -#: noindex-seo.php:3205 +#: noindex-seo.php:5446 msgid "Post Preview" msgstr "Vista previa de entrada" -#: noindex-seo.php:3208 +#: noindex-seo.php:5449 msgid "Block the indexing when viewing post previews." msgstr "Bloquear la indexación al ver vistas previas de entradas." -#: noindex-seo.php:3213 +#: noindex-seo.php:5454 msgid "Error Pages" msgstr "Páginas de error" -#: noindex-seo.php:3216 +#: noindex-seo.php:5457 msgid "Error 404" msgstr "Error 404" -#: noindex-seo.php:3219 +#: noindex-seo.php:5460 msgid "Block the indexing of 404 error pages." msgstr "Bloquear la indexación de las páginas de error 404." #. translators: %s: post type singular name. -#: noindex-seo.php:3244 +#: noindex-seo.php:5485 #, php-format msgid "Block the indexing of individual %s." msgstr "Bloquear la indexación de %s individuales." -#: noindex-seo.php:3248 +#: noindex-seo.php:5489 msgid "Custom Post Types" msgstr "Tipos de contenido personalizados" -#: noindex-seo.php:3273 assets/js/editor-sidebar.js:142 -msgid "noindex" -msgstr "noindex" +#: noindex-seo.php:5502 +msgid "Cart" +msgstr "Carrito" -#: noindex-seo.php:3274 +#: noindex-seo.php:5503 +msgid "Block the indexing of the WooCommerce cart page." +msgstr "Bloquear la indexación de la página del carrito de WooCommerce." + +#: noindex-seo.php:5506 +msgid "Checkout" +msgstr "Finalizar compra" + +#: noindex-seo.php:5507 +msgid "Block the indexing of the WooCommerce checkout page." +msgstr "" +"Bloquear la indexación de la página de finalización de compra de WooCommerce." + +#: noindex-seo.php:5510 +msgid "My Account" +msgstr "Mi cuenta" + +#: noindex-seo.php:5511 +msgid "" +"Block the indexing of the WooCommerce customer account pages (including " +"order history and address endpoints)." +msgstr "" +"Bloquear la indexación de las páginas de la cuenta de cliente de WooCommerce " +"(incluidos el historial de pedidos y las direcciones)." + +#: noindex-seo.php:5531 +msgid "WooCommerce" +msgstr "WooCommerce" + +#: noindex-seo.php:5559 msgid "Prevent search engines from indexing this page" msgstr "Evitar que los buscadores indexen esta página" -#: noindex-seo.php:3278 assets/js/editor-sidebar.js:157 -msgid "nofollow" -msgstr "nofollow" - -#: noindex-seo.php:3279 +#: noindex-seo.php:5564 msgid "Prevent search engines from following links on this page" msgstr "Evitar que los buscadores sigan los enlaces en esta página" -#: noindex-seo.php:3283 assets/js/editor-sidebar.js:172 -msgid "noarchive" -msgstr "noarchive" - -#: noindex-seo.php:3284 +#: noindex-seo.php:5569 msgid "Prevent search engines from showing a cached version" msgstr "Evitar que los buscadores muestren una versión en caché" -#: noindex-seo.php:3288 assets/js/editor-sidebar.js:187 -msgid "nosnippet" -msgstr "nosnippet" - -#: noindex-seo.php:3289 +#: noindex-seo.php:5574 msgid "Prevent search engines from showing text snippets" msgstr "Evitar que los buscadores muestren fragmentos de texto" -#: noindex-seo.php:3293 assets/js/editor-sidebar.js:202 -msgid "noimageindex" -msgstr "noimageindex" - -#: noindex-seo.php:3294 +#: noindex-seo.php:5579 msgid "Prevent search engines from indexing images" msgstr "Evitar que los buscadores indexen imágenes" -#: noindex-seo.php:3301 +#: noindex-seo.php:5584 +msgid "Ask search engines not to translate this page" +msgstr "Pedir a los buscadores que no traduzcan esta página" + +#: noindex-seo.php:5604 +msgid "Stop indexing this page after this date and time" +msgstr "Dejar de indexar esta página a partir de esta fecha y hora" + +#: noindex-seo.php:5611 msgid "noindex SEO Settings" msgstr "Ajustes de noindex SEO" -#: noindex-seo.php:3302 +#: noindex-seo.php:5612 msgid "" "Control how search engines index and display your WordPress content using " "robots directives." @@ -540,71 +658,55 @@ msgstr "" "Controla cómo los buscadores indexan y muestran tu contenido de WordPress " "usando directivas robots." -#: noindex-seo.php:3313 +#: noindex-seo.php:5623 msgid "" "Recommended defaults applied. Review the changes below and click \"Save " "Changes\" to keep them, or uncheck anything you do not want." msgstr "" -"Valores recomendados aplicados. Revisa los cambios de abajo y haz clic en" -"«Guardar cambios» para conservarlos, o desmarca lo que no quieras." +"Valores recomendados aplicados. Revisa los cambios de abajo y haz clic " +"en«Guardar cambios» para conservarlos, o desmarca lo que no quieras." +#: noindex-seo.php:5631 +msgid "Settings imported successfully." +msgstr "Ajustes importados correctamente." -#: noindex-seo.php:3329 -msgid "Apply Recommended Defaults" -msgstr "Aplicar los valores recomendados" - -#: noindex-seo.php:3334 -msgid "Enable all directives for the 12 contexts flagged as recommended." -msgstr "Activa todas las directivas en los 12 contextos marcados como recomendados." - -#: noindex-seo.php:3339 +#: noindex-seo.php:5638 msgid "" -"Enables all 5 directives on the 12 contexts flagged \"Recommended\" (privacy " -"policy, date archives, pagination, search results, attachment pages, " -"previews, 404). Review and save." +"The settings file could not be imported: it is missing, too large, or not a " +"valid noindex SEO export." msgstr "" -"Activa las 5 directivas en los 12 contextos marcados como «Recomendado»" -"(política de privacidad, archivos de fecha, paginación, resultados de" -"búsqueda, páginas de adjuntos, vistas previas y 404). Revisa y guarda." +"No se ha podido importar el archivo de ajustes: falta, es demasiado grande o " +"no es una exportación válida de noindex SEO." +#: noindex-seo.php:5646 +msgid "Settings sections" +msgstr "Secciones de los ajustes" -#: noindex-seo.php:3352 -msgid "Total Options" -msgstr "Opciones totales" - -#: noindex-seo.php:3356 -msgid "Enabled" -msgstr "Activadas" - -#: noindex-seo.php:3360 -msgid "Recommended to Enable" -msgstr "Recomendadas para activar" - -#: noindex-seo.php:3368 +#: noindex-seo.php:5673 msgid "General Configuration" msgstr "Configuración general" -#: noindex-seo.php:3382 +#: noindex-seo.php:5687 msgid "Disable compatibility warnings with other SEO plugins" msgstr "Desactivar avisos de compatibilidad con otros plugins de SEO" -#: noindex-seo.php:3389 +#: noindex-seo.php:5694 msgid "Implementation Method" msgstr "Método de implementación" -#: noindex-seo.php:3397 +#: noindex-seo.php:5702 msgid "HTML Meta Tags (default, easier to verify)" msgstr "Etiquetas meta HTML (predeterminado, más fácil de verificar)" -#: noindex-seo.php:3400 +#: noindex-seo.php:5705 msgid "HTTP Headers (more robust, works with PDFs/images)" msgstr "Cabeceras HTTP (más robusto, funciona con PDFs/imágenes)" -#: noindex-seo.php:3403 +#: noindex-seo.php:5708 msgid "Both (maximum compatibility)" msgstr "Ambos (máxima compatibilidad)" -#: noindex-seo.php:3407 +#: noindex-seo.php:5712 msgid "" "Choose how noindex directives are sent to search engines. Meta tags work for " "HTML pages. HTTP headers work for all content types including PDFs, images, " @@ -614,11 +716,11 @@ msgstr "" "meta funcionan para páginas HTML. Las cabeceras HTTP funcionan para todos " "los tipos de contenido, incluidos PDFs, imágenes y feeds." -#: noindex-seo.php:3425 +#: noindex-seo.php:5730 msgid "Enable per-post/page granular control" msgstr "Activar control granular por entrada/página" -#: noindex-seo.php:3428 +#: noindex-seo.php:5733 msgid "" "When enabled, a meta box will appear in the post/page editor allowing you to " "override global settings for individual content. Useful for specific pages " @@ -628,29 +730,28 @@ msgstr "" "permite sobrescribir los ajustes globales para contenido individual. Útil " "para páginas específicas que necesitan directivas robots diferentes." -#: noindex-seo.php:3446 +#: noindex-seo.php:5751 msgid "Enable per-term granular control" msgstr "Activar el control granular por término" -#: noindex-seo.php:3449 +#: noindex-seo.php:5754 msgid "" "When enabled, a \"Search Engine Visibility\" panel will appear on the Edit " "screen for every public taxonomy (categories, tags, and custom taxonomies " "like WooCommerce product categories). Useful for noindexing a specific " "category or tag without affecting the others." msgstr "" -"Cuando se activa, un panel «Visibilidad en buscadores» aparecerá en la" -"pantalla de edición de todas las taxonomías públicas (categorías, etiquetas" -"y taxonomías personalizadas como las categorías de producto de WooCommerce)." -"Resulta útil para aplicar noindex a una categoría o etiqueta concreta sin" -"afectar a las demás." +"Cuando se activa, un panel «Visibilidad en buscadores» aparecerá en " +"lapantalla de edición de todas las taxonomías públicas (categorías, " +"etiquetasy taxonomías personalizadas como las categorías de producto de " +"WooCommerce).Resulta útil para aplicar noindex a una categoría o etiqueta " +"concreta sinafectar a las demás." - -#: noindex-seo.php:3467 +#: noindex-seo.php:5772 msgid "Delete all plugin data on uninstall" msgstr "Borrar todos los datos del plugin al desinstalar" -#: noindex-seo.php:3470 +#: noindex-seo.php:5775 msgid "" "When enabled, all settings and per-post robots directives will be " "permanently deleted when the plugin is uninstalled. By default data is " @@ -660,7 +761,52 @@ msgstr "" "borrarán de forma permanente al desinstalar el plugin. Por defecto, los " "datos se conservan." -#: noindex-seo.php:3479 +#: noindex-seo.php:5791 +msgid "Recommended settings" +msgstr "Ajustes recomendados" + +#: noindex-seo.php:5793 +msgid "" +"Enables all 5 directives on the 15 contexts flagged \"Recommended\" (privacy " +"policy, date archives, pagination, search results, attachment pages, " +"previews, 404, WooCommerce cart / checkout / my account). Review and save." +msgstr "" +"Activa las 5 directivas en los 15 contextos marcados como " +"«Recomendado» (política de privacidad, archivos de fecha, paginación, " +"resultados de búsqueda, páginas de adjuntos, vistas previas, 404 y carrito, " +"finalización de compra y mi cuenta de WooCommerce). Revisa y guarda." + +#: noindex-seo.php:5800 +msgid "Apply Recommended Defaults" +msgstr "Aplicar los valores recomendados" + +#: noindex-seo.php:5805 +msgid "Enable all directives for the 15 contexts flagged as recommended." +msgstr "" +"Activar todas las directivas de los 15 contextos marcados como recomendados." +"Activa todas las directivas en los 15 contextos marcados como recomendados." + +#: noindex-seo.php:5819 +msgid "Overview" +msgstr "Resumen" + +#: noindex-seo.php:5823 +msgid "Total Options" +msgstr "Opciones totales" + +#: noindex-seo.php:5827 +msgid "Enabled" +msgstr "Activadas" + +#: noindex-seo.php:5831 +msgid "Recommended to Enable" +msgstr "Recomendadas para activar" + +#: noindex-seo.php:5836 +msgid "Page contexts" +msgstr "Contextos de página" + +#: noindex-seo.php:5841 msgid "" "Important: Enabling noindex on the wrong pages can harm your search engine " "rankings. Only enable options you fully understand." @@ -669,52 +815,264 @@ msgstr "" "posicionamiento en buscadores. Activa solo las opciones que entiendas " "completamente." -#: noindex-seo.php:3486 +#: noindex-seo.php:5848 msgid "Search options..." msgstr "Buscar opciones…" -#: noindex-seo.php:3487 +#: noindex-seo.php:5849 msgid "Search options" msgstr "Buscar opciones" -#: noindex-seo.php:3512 +#: noindex-seo.php:5874 msgid "This option only works with HTTP Headers implementation method" msgstr "" -"Esta opción solo funciona con el método de implementación de cabeceras HTTP" +"Esta opción solo funciona con el método de implementación de cabeceras " +"HTTPEsta opción solo funciona con el método de implementación de cabeceras " +"HTTP" -#: noindex-seo.php:3521 +#: noindex-seo.php:5883 msgid "Not Recommended" msgstr "No recomendado" -#: noindex-seo.php:3526 +#: noindex-seo.php:5888 msgid "View Page" msgstr "Ver página" -#: assets/js/editor-sidebar.js:103 +#: noindex-seo.php:5969 noindex-seo.php:5977 +msgid "Conditional rules" +msgstr "Reglas condicionales" + +#: noindex-seo.php:5971 +msgid "" +"Automatically apply noindex to any post whose custom field (for example an " +"ACF field) exactly matches a value. Rules run below the per-post overrides " +"and above the global context settings, and matched posts drop out of the XML " +"sitemap." +msgstr "" +"Aplicar automáticamente noindex a cualquier entrada cuyo campo personalizado " +"(por ejemplo, un campo de ACF) coincida exactamente con un valor. Las reglas " +"se ejecutan por debajo de los ajustes individuales de cada entrada y por " +"encima de los ajustes globales de contexto, y las entradas coincidentes " +"desaparecen del mapa del sitio XML." + +#: noindex-seo.php:5984 +msgid "Field name" +msgstr "Nombre del campo" + +#: noindex-seo.php:5985 +msgid "Value" +msgstr "Valor" + +#: noindex-seo.php:5986 noindex-seo.php:6210 +msgid "Actions" +msgstr "Acciones" + +#: noindex-seo.php:6002 +msgid "custom_field_name" +msgstr "nombre_campo_personalizado" + +#: noindex-seo.php:6003 +msgid "value that triggers noindex" +msgstr "valor que activa noindex" + +#: noindex-seo.php:6004 noindex-seo.php:6231 +msgid "Remove rule" +msgstr "Eliminar regla" + +#: noindex-seo.php:6009 noindex-seo.php:6236 +msgid "Add rule" +msgstr "Añadir regla" + +#: noindex-seo.php:6010 +msgid "Up to 20 rules. Rows with an empty field or value are ignored." +msgstr "Hasta 20 reglas. Las filas con un campo o un valor vacíos se ignoran." + +#. translators: %d: number of posts. +#: noindex-seo.php:6036 +#, php-format +msgid "Imported robots overrides for %d post" +msgid_plural "Imported robots overrides for %d posts" +msgstr[0] "Se han importado ajustos robots para %d entrada" +msgstr[1] "Se han importado ajustos robots para %d entradas" + +#. translators: %d: number of terms. +#. translators: %d: number of terms found. +#: noindex-seo.php:6041 noindex-seo.php:6105 +#, php-format +msgid "%d term" +msgid_plural "%d terms" +msgstr[0] "%d término" +msgstr[1] "%d términos" + +#. translators: 1: number of skipped posts, 2: number of skipped terms. +#: noindex-seo.php:6052 +#, php-format +msgid "%1$d posts and %2$d terms skipped (already configured)" +msgstr "%1$d entradas y %2$d términos omitidos (ya estaban configurados)" + +#: noindex-seo.php:6062 +msgid "No plugins were selected to import from." +msgstr "No se ha seleccionado ningún plugin del que importar." + +#: noindex-seo.php:6067 +msgid "The selected plugins had no importable robots data left." +msgstr "Los plugins seleccionados no tenían ningún dato robots importable." + +#: noindex-seo.php:6073 +msgid "Import from other plugins" +msgstr "Importar de otros plugins" + +#: noindex-seo.php:6075 +msgid "" +"Imports the noindex and nofollow flags stored by other SEO plugins (Yoast " +"SEO, Rank Math, SEOPress, All in One SEO) as per-post and per-term " +"overrides. Nothing is imported automatically: you pick the plugins below and " +"confirm. Content that already has its own override is never touched." +msgstr "" +"Importa los ajustes noindex y nofollow guardados por otros plugins de SEO " +"(Yoast SEO, Rank Math, SEOPress, All in One SEO) como anulaciones por " +"entrada y por término. No se importa nada automáticamente: eliges los " +"plugins de abajo y confirmas. El contenido que ya tenga su propia anulación " +"no se toca." + +#. translators: %d: number of posts found. +#: noindex-seo.php:6094 +#, php-format +msgid "%d post" +msgid_plural "%d posts" +msgstr[0] "%d entrada" +msgstr[1] "%d entradas" + +#: noindex-seo.php:6116 +msgid "" +"No importable robots data from other SEO plugins was found on this site." +msgstr "" +"No se han encontrado datos robots importables de otros plugins de SEO en " +"este sitio." + +#: noindex-seo.php:6120 +msgid "Import selected plugins" +msgstr "Importar los plugins seleccionados" + +#: noindex-seo.php:6130 noindex-seo.php:6139 +msgid "Export settings" +msgstr "Exportar ajustes" + +#: noindex-seo.php:6132 +msgid "Download the current settings as a JSON file." +msgstr "Descarga los ajustes actuales en un archivo JSON." + +#: noindex-seo.php:6148 noindex-seo.php:6156 noindex-seo.php:6166 +msgid "Import settings" +msgstr "Importar ajustes" + +#: noindex-seo.php:6150 +msgid "" +"Restore the global settings from a previously exported JSON file. Per-post " +"and per-term overrides are kept." +msgstr "" +"Restaura los ajustes globales desde un archivo JSON exportado anteriormente. " +"Las sobrescrituras por entrada y por término se conservan." + +#: noindex-seo.php:6198 +msgid "Extend the virtual robots.txt with bot rules" +msgstr "Ampliar el robots.txt virtual con reglas para bots" + +#: noindex-seo.php:6201 +msgid "" +"Inactive by default. When enabled, the rules below are appended to the " +"robots.txt that WordPress generates virtually — they never replace it. This " +"only applies when WordPress serves robots.txt itself: a physical robots.txt " +"file in the site root, or \"Discourage search engines\" in Reading settings, " +"takes precedence." +msgstr "" +"Inactivo por defecto. Al activarlo, las reglas de abajo se añaden al final " +"del robots.txt que WordPress genera virtualmente; nunca lo sustituyen. Solo " +"se aplica cuando WordPress sirve el robots.txt él mismo: un archivo robots." +"txt físico en la raíz del sitio o la opción «Disuadir a los motores de " +"búsqueda» en Ajustos de lectura tienen prioridad." + +#: noindex-seo.php:6208 +msgid "User-agent" +msgstr "User-agent" + +#: noindex-seo.php:6209 +msgid "Policy" +msgstr "Política" + +#: noindex-seo.php:6226 +msgid "User-agent token, e.g. GPTBot or *" +msgstr "Token de user-agent, por ejemplo GPTBot o *" + +#: noindex-seo.php:6228 +msgid "Block (Disallow: /)" +msgstr "Bloquear (Disallow: /)" + +#: noindex-seo.php:6229 +msgid "Allow (Allow: /)" +msgstr "Permitir (Allow: /)" + +#: noindex-seo.php:6237 +msgid "Add common AI bots" +msgstr "Añadir bots de IA habituales" + +#: noindex-seo.php:6238 +msgid "Add common search engine bots" +msgstr "Añadir bots de buscadores habituales" + +#: noindex-seo.php:6241 +msgid "" +"Up to 30 rules. Blocked bots receive \"Disallow: /\" for the whole site; " +"allowed bots receive \"Allow: /\" (useful to allow one crawler inside a " +"broader block set with a * rule). Duplicate user-agents are ignored." +msgstr "" +"Hasta 30 reglas. Los bots bloqueados reciben «Disallow: /» para todo el " +"sitio; los permitidos reciben «Allow: /» (útil para permitir un rastreador " +"dentro de un bloqueo más amplio definido con *). Los user-agent duplicados " +"se ignoran." + +#: noindex-seo.php:6247 +msgid "Preview of the appended block" +msgstr "Vista previa del bloque añadido" + +#: assets/js/editor-sidebar.js:188 msgid "Enable to set custom robots directives for this content" msgstr "" -"Activa para establecer directivas robots personalizadas para este contenido" +"Actívala para definir directivas robots personalizadas para este " +"contenidoActiva para establecer directivas robots personalizadas para este " +"contenido" -#: assets/js/editor-sidebar.js:133 +#: assets/js/editor-sidebar.js:218 msgid "Robots Directives:" msgstr "Directivas robots:" -#: assets/js/editor-sidebar.js:143 -msgid "Prevent search engines from indexing" -msgstr "Evitar que los buscadores indexen" - -#: assets/js/editor-sidebar.js:158 -msgid "Prevent search engines from following links" -msgstr "Evitar que los buscadores sigan los enlaces" - -#: assets/js/editor-sidebar.js:173 -msgid "Prevent cached versions in search results" -msgstr "Evitar versiones en caché en los resultados de búsqueda" - -#: assets/js/editor-sidebar.js:188 -msgid "Prevent text snippets in search results" -msgstr "Evitar fragmentos de texto en los resultados de búsqueda" - -#: assets/js/editor-sidebar.js:237 +#: assets/js/editor-sidebar.js:249 msgid "Active Directives:" msgstr "Directivas activas:" + +#~ msgid "Prevent search engines from indexing" +#~ msgstr "Evitar que los buscadores indexen" + +#~ msgid "Prevent search engines from following links" +#~ msgstr "Evitar que los buscadores sigan los enlaces" + +#~ msgid "Prevent cached versions in search results" +#~ msgstr "Evitar versiones en caché en los resultados de búsqueda" + +#~ msgid "Prevent text snippets in search results" +#~ msgstr "Evitar fragmentos de texto en los resultados de búsqueda" + +#~ msgid "🔍 noindex" +#~ msgstr "🔍 noindex" + +#~ msgid "🔗 nofollow" +#~ msgstr "🔗 nofollow" + +#~ msgid "💾 noarchive" +#~ msgstr "💾 noarchive" + +#~ msgid "📄 nosnippet" +#~ msgstr "📄 nosnippet" + +#~ msgid "🖼️ noimageindex" +#~ msgstr "🖼️ noimageindex" diff --git a/languages/noindex-seo.pot b/languages/noindex-seo.pot index 9ba7c20..507379b 100644 --- a/languages/noindex-seo.pot +++ b/languages/noindex-seo.pot @@ -2,22 +2,22 @@ # This file is distributed under the GPL-3.0-or-later. msgid "" msgstr "" -"Project-Id-Version: noindex SEO 3.1.3\n" +"Project-Id-Version: noindex SEO 3.7.0\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/noindex-seo\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2026-08-17T19:24:59+00:00\n" +"POT-Creation-Date: 2026-11-03T20:17:27+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.12.0\n" "X-Domain: noindex-seo\n" #. Plugin Name of the plugin #: noindex-seo.php -#: noindex-seo.php:1405 -#: noindex-seo.php:1406 +#: noindex-seo.php:2590 +#: noindex-seo.php:2591 msgid "noindex SEO" msgstr "" @@ -41,160 +41,263 @@ msgstr "" msgid "https://www.robotstxt.software/" msgstr "" -#: noindex-seo.php:1036 +#: noindex-seo.php:1993 msgid "Post ID to compute effective directives for." msgstr "" -#: noindex-seo.php:1065 +#: noindex-seo.php:2020 msgid "You do not have permission to read the noindex SEO settings." msgstr "" -#: noindex-seo.php:1118 +#: noindex-seo.php:2070 msgid "You do not have permission to read directives for this post." msgstr "" -#: noindex-seo.php:1176 +#: noindex-seo.php:2133 msgid "No post exists with that post_id." msgstr "" -#: noindex-seo.php:1301 +#: noindex-seo.php:2439 msgid "Settings saved successfully!" msgstr "" -#: noindex-seo.php:1302 +#: noindex-seo.php:2440 msgid "Expand All" msgstr "" -#: noindex-seo.php:1303 +#: noindex-seo.php:2441 msgid "Collapse All" msgstr "" -#: noindex-seo.php:1385 +#: noindex-seo.php:2523 msgid "Settings" msgstr "" #. translators: plugin name. -#: noindex-seo.php:1627 +#: noindex-seo.php:2816 #, php-format msgid "noindex SEO has detected that %s is active. This may cause conflicts. Please configure the options accordingly." msgstr "" -#: noindex-seo.php:1657 -#: noindex-seo.php:1756 -msgid "Permission denied or invalid nonce." +#. translators: %s: comma-separated list of wp_robots callbacks. +#: noindex-seo.php:2837 +#, php-format +msgid "noindex SEO has detected that another plugin or theme is adding robots directives through the wp_robots API (%s). This may cause conflicts. Please configure the options accordingly." msgstr "" -#: noindex-seo.php:1914 -#: noindex-seo.php:2238 -#: assets/js/editor-sidebar.js:91 +#: noindex-seo.php:2954 +#: noindex-seo.php:3129 +#: noindex-seo.php:3180 +#: noindex-seo.php:3284 +#: noindex-seo.php:3345 +msgid "Permission denied." +msgstr "" + +#: noindex-seo.php:4033 +#: noindex-seo.php:4422 +#: assets/js/editor-sidebar.js:176 msgid "Search Engine Visibility" msgstr "" -#: noindex-seo.php:1966 -#: noindex-seo.php:2597 -#: assets/js/editor-sidebar.js:102 +#: noindex-seo.php:4094 +#: noindex-seo.php:4792 +#: assets/js/editor-sidebar.js:187 msgid "Override global settings" msgstr "" -#: noindex-seo.php:1971 +#: noindex-seo.php:4099 msgid "When enabled, these directives will override the global settings for this specific content." msgstr "" -#: noindex-seo.php:1978 +#: noindex-seo.php:4106 msgid "Prevent indexing" msgstr "" -#: noindex-seo.php:1983 +#: noindex-seo.php:4111 msgid "Prevent link following" msgstr "" -#: noindex-seo.php:1988 +#: noindex-seo.php:4116 msgid "Prevent caching" msgstr "" -#: noindex-seo.php:1993 +#: noindex-seo.php:4121 msgid "Prevent snippets" msgstr "" -#: noindex-seo.php:1998 -#: assets/js/editor-sidebar.js:203 +#: noindex-seo.php:4126 msgid "Prevent image indexing" msgstr "" -#: noindex-seo.php:2006 +#: noindex-seo.php:4131 +msgid "Prevent translation" +msgstr "" + +#: noindex-seo.php:4136 +msgid "Value directives (empty = off):" +msgstr "" + +#: noindex-seo.php:4139 +#: noindex-seo.php:4145 +#: noindex-seo.php:4154 +#: noindex-seo.php:4441 +#: noindex-seo.php:4449 +#: noindex-seo.php:4826 +#: noindex-seo.php:4831 +#: noindex-seo.php:4839 +#: noindex-seo.php:5923 +#: noindex-seo.php:5939 +#: assets/js/editor-sidebar.js:141 +msgid "Off" +msgstr "" + +#: noindex-seo.php:4140 +#: noindex-seo.php:5589 +msgid "Maximum snippet length in characters (-1 = no limit)" +msgstr "" + +#: noindex-seo.php:4146 +#: noindex-seo.php:4442 +#: noindex-seo.php:4832 +#: noindex-seo.php:5940 +#: assets/js/editor-sidebar.js:142 +msgid "none" +msgstr "" + +#: noindex-seo.php:4147 +#: noindex-seo.php:4443 +#: noindex-seo.php:4833 +#: noindex-seo.php:5941 +#: assets/js/editor-sidebar.js:143 +msgid "standard" +msgstr "" + +#: noindex-seo.php:4148 +#: noindex-seo.php:4444 +#: noindex-seo.php:4834 +#: noindex-seo.php:5942 +#: assets/js/editor-sidebar.js:144 +msgid "large" +msgstr "" + +#: noindex-seo.php:4150 +#: noindex-seo.php:5594 +msgid "Maximum image preview size" +msgstr "" + +#: noindex-seo.php:4155 +#: noindex-seo.php:5599 +msgid "Maximum video preview seconds (-1 = no limit)" +msgstr "" + +#: noindex-seo.php:4160 +msgid "Stop indexing after this date and time" +msgstr "" + +#: noindex-seo.php:4168 msgid "Effective Directives:" msgstr "" -#: noindex-seo.php:2031 +#: noindex-seo.php:4178 msgid "Override active:" msgstr "" -#: noindex-seo.php:2036 +#: noindex-seo.php:4183 msgid "Override enabled but no directives selected" msgstr "" -#: noindex-seo.php:2042 +#: noindex-seo.php:4189 msgid "Global settings:" msgstr "" -#: noindex-seo.php:2047 +#: noindex-seo.php:4194 msgid "No restrictions (indexable)" msgstr "" -#: noindex-seo.php:2242 +#: noindex-seo.php:4426 msgid "Override global settings for this term" msgstr "" -#: noindex-seo.php:2255 +#: noindex-seo.php:4457 msgid "When override is enabled, the directives checked above apply to this term's archive page and take precedence over the global category / tag / archive settings." msgstr "" -#: noindex-seo.php:2350 -#: noindex-seo.php:2356 -#: noindex-seo.php:2488 -#: noindex-seo.php:2494 +#: noindex-seo.php:4559 +#: noindex-seo.php:4565 +#: noindex-seo.php:4681 +#: noindex-seo.php:4687 msgid "Robots" msgstr "" -#: noindex-seo.php:2417 -#: noindex-seo.php:2543 +#: noindex-seo.php:4623 +#: noindex-seo.php:4742 msgid "Override (none)" msgstr "" -#: noindex-seo.php:2593 +#: noindex-seo.php:4788 msgid "Robots Directives" msgstr "" -#: noindex-seo.php:2602 -msgid "🔍 noindex" +#: noindex-seo.php:4798 +#: noindex-seo.php:5558 +msgid "noindex" msgstr "" -#: noindex-seo.php:2606 -msgid "🔗 nofollow" +#: noindex-seo.php:4803 +#: noindex-seo.php:5563 +msgid "nofollow" msgstr "" -#: noindex-seo.php:2610 -msgid "💾 noarchive" +#: noindex-seo.php:4808 +#: noindex-seo.php:5568 +msgid "noarchive" msgstr "" -#: noindex-seo.php:2614 -msgid "📄 nosnippet" +#: noindex-seo.php:4813 +#: noindex-seo.php:5573 +msgid "nosnippet" msgstr "" -#: noindex-seo.php:2618 -msgid "🖼️ noimageindex" +#: noindex-seo.php:4818 +#: noindex-seo.php:5578 +msgid "noimageindex" msgstr "" -#: noindex-seo.php:2729 +#: noindex-seo.php:4823 +#: noindex-seo.php:5583 +msgid "notranslate" +msgstr "" + +#: noindex-seo.php:4827 +#: noindex-seo.php:5588 +msgid "max-snippet" +msgstr "" + +#: noindex-seo.php:4836 +#: noindex-seo.php:5593 +msgid "max-image-preview" +msgstr "" + +#: noindex-seo.php:4840 +#: noindex-seo.php:5598 +msgid "max-video-preview" +msgstr "" + +#: noindex-seo.php:4844 +#: noindex-seo.php:5603 +msgid "unavailable_after" +msgstr "" + +#: noindex-seo.php:4957 msgid "Enable Robots Override" msgstr "" -#: noindex-seo.php:2730 +#: noindex-seo.php:4958 msgid "Disable Robots Override" msgstr "" #. translators: %d: Number of posts updated -#: noindex-seo.php:2827 +#: noindex-seo.php:5050 #, php-format msgid "Robots override enabled for %d post." msgid_plural "Robots override enabled for %d posts." @@ -202,467 +305,666 @@ msgstr[0] "" msgstr[1] "" #. translators: %d: Number of posts updated -#: noindex-seo.php:2848 +#: noindex-seo.php:5071 #, php-format msgid "Robots override disabled for %d post." msgid_plural "Robots override disabled for %d posts." msgstr[0] "" msgstr[1] "" -#: noindex-seo.php:2897 +#: noindex-seo.php:5120 msgid "All robots settings" msgstr "" -#: noindex-seo.php:2899 +#: noindex-seo.php:5122 msgid "With override" msgstr "" -#: noindex-seo.php:2902 +#: noindex-seo.php:5125 msgid "Without override" msgstr "" -#: noindex-seo.php:3016 +#: noindex-seo.php:5244 msgid "You do not have sufficient permissions to access this page." msgstr "" -#: noindex-seo.php:3017 +#: noindex-seo.php:5245 msgid "Permission Denied" msgstr "" -#: noindex-seo.php:3039 +#: noindex-seo.php:5257 +msgid "General" +msgstr "" + +#: noindex-seo.php:5258 +msgid "SEO Settings" +msgstr "" + +#: noindex-seo.php:5259 +msgid "Import / Export" +msgstr "" + +#: noindex-seo.php:5260 +msgid "Robots.txt" +msgstr "" + +#: noindex-seo.php:5280 msgid "Main Pages" msgstr "" -#: noindex-seo.php:3042 +#: noindex-seo.php:5283 msgid "Front Page" msgstr "" -#: noindex-seo.php:3043 -#: noindex-seo.php:3050 -#: noindex-seo.php:3062 -#: noindex-seo.php:3068 -#: noindex-seo.php:3075 -#: noindex-seo.php:3081 -#: noindex-seo.php:3092 -#: noindex-seo.php:3098 -#: noindex-seo.php:3109 -#: noindex-seo.php:3115 -#: noindex-seo.php:3121 -#: noindex-seo.php:3127 -#: noindex-seo.php:3133 -#: noindex-seo.php:3144 -#: noindex-seo.php:3150 -#: noindex-seo.php:3156 -#: noindex-seo.php:3167 -#: noindex-seo.php:3178 -#: noindex-seo.php:3189 -#: noindex-seo.php:3200 -#: noindex-seo.php:3206 -#: noindex-seo.php:3217 -#: noindex-seo.php:3241 -#: noindex-seo.php:3519 +#: noindex-seo.php:5284 +#: noindex-seo.php:5291 +#: noindex-seo.php:5303 +#: noindex-seo.php:5309 +#: noindex-seo.php:5316 +#: noindex-seo.php:5322 +#: noindex-seo.php:5333 +#: noindex-seo.php:5339 +#: noindex-seo.php:5350 +#: noindex-seo.php:5356 +#: noindex-seo.php:5362 +#: noindex-seo.php:5368 +#: noindex-seo.php:5374 +#: noindex-seo.php:5385 +#: noindex-seo.php:5391 +#: noindex-seo.php:5397 +#: noindex-seo.php:5408 +#: noindex-seo.php:5419 +#: noindex-seo.php:5430 +#: noindex-seo.php:5441 +#: noindex-seo.php:5447 +#: noindex-seo.php:5458 +#: noindex-seo.php:5482 +#: noindex-seo.php:5523 +#: noindex-seo.php:5881 msgid "Recommended" msgstr "" -#: noindex-seo.php:3045 +#: noindex-seo.php:5286 msgid "Block the indexing of the site's front page." msgstr "" -#: noindex-seo.php:3049 +#: noindex-seo.php:5290 msgid "Home" msgstr "" -#: noindex-seo.php:3052 +#: noindex-seo.php:5293 msgid "Block the indexing of the site's home page." msgstr "" -#: noindex-seo.php:3058 +#: noindex-seo.php:5299 msgid "Pages and Posts" msgstr "" -#: noindex-seo.php:3061 +#: noindex-seo.php:5302 msgid "Page" msgstr "" -#: noindex-seo.php:3064 +#: noindex-seo.php:5305 msgid "Block the indexing of site pages." msgstr "" -#: noindex-seo.php:3067 +#: noindex-seo.php:5308 msgid "Privacy Policy" msgstr "" -#: noindex-seo.php:3070 +#: noindex-seo.php:5311 msgid "Block the indexing of the privacy policy page." msgstr "" -#: noindex-seo.php:3074 +#: noindex-seo.php:5315 msgid "Single Post" msgstr "" -#: noindex-seo.php:3077 +#: noindex-seo.php:5318 msgid "Block the indexing of individual posts." msgstr "" -#: noindex-seo.php:3080 +#: noindex-seo.php:5321 msgid "Singular" msgstr "" -#: noindex-seo.php:3083 +#: noindex-seo.php:5324 msgid "Block the indexing of any singular content (post or page)." msgstr "" -#: noindex-seo.php:3088 +#: noindex-seo.php:5329 msgid "Taxonomies" msgstr "" -#: noindex-seo.php:3091 +#: noindex-seo.php:5332 msgid "Category" msgstr "" -#: noindex-seo.php:3094 +#: noindex-seo.php:5335 msgid "Block the indexing of category archive pages." msgstr "" -#: noindex-seo.php:3097 +#: noindex-seo.php:5338 msgid "Tag" msgstr "" -#: noindex-seo.php:3100 +#: noindex-seo.php:5341 msgid "Block the indexing of tag archive pages." msgstr "" -#: noindex-seo.php:3105 +#: noindex-seo.php:5346 msgid "Date Archives" msgstr "" -#: noindex-seo.php:3108 +#: noindex-seo.php:5349 msgid "Date" msgstr "" -#: noindex-seo.php:3111 +#: noindex-seo.php:5352 msgid "Block the indexing of any date-based archive page." msgstr "" -#: noindex-seo.php:3114 +#: noindex-seo.php:5355 msgid "Day" msgstr "" -#: noindex-seo.php:3117 +#: noindex-seo.php:5358 msgid "Block the indexing of daily archive pages." msgstr "" -#: noindex-seo.php:3120 +#: noindex-seo.php:5361 msgid "Month" msgstr "" -#: noindex-seo.php:3123 +#: noindex-seo.php:5364 msgid "Block the indexing of monthly archive pages." msgstr "" -#: noindex-seo.php:3126 +#: noindex-seo.php:5367 msgid "Time" msgstr "" -#: noindex-seo.php:3129 +#: noindex-seo.php:5370 msgid "Block the indexing of time-based archive pages." msgstr "" -#: noindex-seo.php:3132 +#: noindex-seo.php:5373 msgid "Year" msgstr "" -#: noindex-seo.php:3135 +#: noindex-seo.php:5376 msgid "Block the indexing of yearly archive pages." msgstr "" -#: noindex-seo.php:3140 +#: noindex-seo.php:5381 msgid "Archives" msgstr "" -#: noindex-seo.php:3143 +#: noindex-seo.php:5384 msgid "Archive" msgstr "" -#: noindex-seo.php:3146 +#: noindex-seo.php:5387 msgid "Block the indexing of any type of archive page." msgstr "" -#: noindex-seo.php:3149 +#: noindex-seo.php:5390 msgid "Author" msgstr "" -#: noindex-seo.php:3152 +#: noindex-seo.php:5393 msgid "Block the indexing of author archive pages." msgstr "" -#: noindex-seo.php:3155 +#: noindex-seo.php:5396 msgid "Post Type Archive" msgstr "" -#: noindex-seo.php:3158 +#: noindex-seo.php:5399 msgid "Block the indexing of post type archive pages." msgstr "" -#: noindex-seo.php:3163 +#: noindex-seo.php:5404 msgid "Pagination" msgstr "" -#: noindex-seo.php:3166 +#: noindex-seo.php:5407 msgid "Paginated Pages" msgstr "" -#: noindex-seo.php:3169 +#: noindex-seo.php:5410 msgid "Block the indexing of pagination pages (page 2, 3, etc.)." msgstr "" -#: noindex-seo.php:3174 +#: noindex-seo.php:5415 msgid "Search" msgstr "" -#: noindex-seo.php:3177 +#: noindex-seo.php:5418 msgid "Search Results" msgstr "" -#: noindex-seo.php:3180 +#: noindex-seo.php:5421 msgid "Block the indexing of search result pages." msgstr "" -#: noindex-seo.php:3185 +#: noindex-seo.php:5426 msgid "Attachments" msgstr "" -#: noindex-seo.php:3188 +#: noindex-seo.php:5429 msgid "Attachment Pages" msgstr "" -#: noindex-seo.php:3191 +#: noindex-seo.php:5432 msgid "Block the indexing of attachment pages (does not affect the file itself)." msgstr "" -#: noindex-seo.php:3196 +#: noindex-seo.php:5437 msgid "Previews" msgstr "" -#: noindex-seo.php:3199 +#: noindex-seo.php:5440 msgid "Customize Preview" msgstr "" -#: noindex-seo.php:3202 +#: noindex-seo.php:5443 msgid "Block the indexing when content is in customize preview mode." msgstr "" -#: noindex-seo.php:3205 +#: noindex-seo.php:5446 msgid "Post Preview" msgstr "" -#: noindex-seo.php:3208 +#: noindex-seo.php:5449 msgid "Block the indexing when viewing post previews." msgstr "" -#: noindex-seo.php:3213 +#: noindex-seo.php:5454 msgid "Error Pages" msgstr "" -#: noindex-seo.php:3216 +#: noindex-seo.php:5457 msgid "Error 404" msgstr "" -#: noindex-seo.php:3219 +#: noindex-seo.php:5460 msgid "Block the indexing of 404 error pages." msgstr "" #. translators: %s: post type singular name. -#: noindex-seo.php:3244 +#: noindex-seo.php:5485 #, php-format msgid "Block the indexing of individual %s." msgstr "" -#: noindex-seo.php:3248 +#: noindex-seo.php:5489 msgid "Custom Post Types" msgstr "" -#: noindex-seo.php:3273 -#: assets/js/editor-sidebar.js:142 -msgid "noindex" +#: noindex-seo.php:5502 +msgid "Cart" msgstr "" -#: noindex-seo.php:3274 +#: noindex-seo.php:5503 +msgid "Block the indexing of the WooCommerce cart page." +msgstr "" + +#: noindex-seo.php:5506 +msgid "Checkout" +msgstr "" + +#: noindex-seo.php:5507 +msgid "Block the indexing of the WooCommerce checkout page." +msgstr "" + +#: noindex-seo.php:5510 +msgid "My Account" +msgstr "" + +#: noindex-seo.php:5511 +msgid "Block the indexing of the WooCommerce customer account pages (including order history and address endpoints)." +msgstr "" + +#: noindex-seo.php:5531 +msgid "WooCommerce" +msgstr "" + +#: noindex-seo.php:5559 msgid "Prevent search engines from indexing this page" msgstr "" -#: noindex-seo.php:3278 -#: assets/js/editor-sidebar.js:157 -msgid "nofollow" -msgstr "" - -#: noindex-seo.php:3279 +#: noindex-seo.php:5564 msgid "Prevent search engines from following links on this page" msgstr "" -#: noindex-seo.php:3283 -#: assets/js/editor-sidebar.js:172 -msgid "noarchive" -msgstr "" - -#: noindex-seo.php:3284 +#: noindex-seo.php:5569 msgid "Prevent search engines from showing a cached version" msgstr "" -#: noindex-seo.php:3288 -#: assets/js/editor-sidebar.js:187 -msgid "nosnippet" -msgstr "" - -#: noindex-seo.php:3289 +#: noindex-seo.php:5574 msgid "Prevent search engines from showing text snippets" msgstr "" -#: noindex-seo.php:3293 -#: assets/js/editor-sidebar.js:202 -msgid "noimageindex" -msgstr "" - -#: noindex-seo.php:3294 +#: noindex-seo.php:5579 msgid "Prevent search engines from indexing images" msgstr "" -#: noindex-seo.php:3301 +#: noindex-seo.php:5584 +msgid "Ask search engines not to translate this page" +msgstr "" + +#: noindex-seo.php:5604 +msgid "Stop indexing this page after this date and time" +msgstr "" + +#: noindex-seo.php:5611 msgid "noindex SEO Settings" msgstr "" -#: noindex-seo.php:3302 +#: noindex-seo.php:5612 msgid "Control how search engines index and display your WordPress content using robots directives." msgstr "" -#: noindex-seo.php:3313 +#: noindex-seo.php:5623 msgid "Recommended defaults applied. Review the changes below and click \"Save Changes\" to keep them, or uncheck anything you do not want." msgstr "" -#: noindex-seo.php:3329 -msgid "Apply Recommended Defaults" +#: noindex-seo.php:5631 +msgid "Settings imported successfully." msgstr "" -#: noindex-seo.php:3334 -msgid "Enable all directives for the 12 contexts flagged as recommended." +#: noindex-seo.php:5638 +msgid "The settings file could not be imported: it is missing, too large, or not a valid noindex SEO export." msgstr "" -#: noindex-seo.php:3339 -msgid "Enables all 5 directives on the 12 contexts flagged \"Recommended\" (privacy policy, date archives, pagination, search results, attachment pages, previews, 404). Review and save." +#: noindex-seo.php:5646 +msgid "Settings sections" msgstr "" -#: noindex-seo.php:3352 -msgid "Total Options" -msgstr "" - -#: noindex-seo.php:3356 -msgid "Enabled" -msgstr "" - -#: noindex-seo.php:3360 -msgid "Recommended to Enable" -msgstr "" - -#: noindex-seo.php:3368 +#: noindex-seo.php:5673 msgid "General Configuration" msgstr "" -#: noindex-seo.php:3382 +#: noindex-seo.php:5687 msgid "Disable compatibility warnings with other SEO plugins" msgstr "" -#: noindex-seo.php:3389 +#: noindex-seo.php:5694 msgid "Implementation Method" msgstr "" -#: noindex-seo.php:3397 +#: noindex-seo.php:5702 msgid "HTML Meta Tags (default, easier to verify)" msgstr "" -#: noindex-seo.php:3400 +#: noindex-seo.php:5705 msgid "HTTP Headers (more robust, works with PDFs/images)" msgstr "" -#: noindex-seo.php:3403 +#: noindex-seo.php:5708 msgid "Both (maximum compatibility)" msgstr "" -#: noindex-seo.php:3407 +#: noindex-seo.php:5712 msgid "Choose how noindex directives are sent to search engines. Meta tags work for HTML pages. HTTP headers work for all content types including PDFs, images, and feeds." msgstr "" -#: noindex-seo.php:3425 +#: noindex-seo.php:5730 msgid "Enable per-post/page granular control" msgstr "" -#: noindex-seo.php:3428 +#: noindex-seo.php:5733 msgid "When enabled, a meta box will appear in the post/page editor allowing you to override global settings for individual content. Useful for specific pages that need different robots directives." msgstr "" -#: noindex-seo.php:3446 +#: noindex-seo.php:5751 msgid "Enable per-term granular control" msgstr "" -#: noindex-seo.php:3449 +#: noindex-seo.php:5754 msgid "When enabled, a \"Search Engine Visibility\" panel will appear on the Edit screen for every public taxonomy (categories, tags, and custom taxonomies like WooCommerce product categories). Useful for noindexing a specific category or tag without affecting the others." msgstr "" -#: noindex-seo.php:3467 +#: noindex-seo.php:5772 msgid "Delete all plugin data on uninstall" msgstr "" -#: noindex-seo.php:3470 +#: noindex-seo.php:5775 msgid "When enabled, all settings and per-post robots directives will be permanently deleted when the plugin is uninstalled. By default data is preserved." msgstr "" -#: noindex-seo.php:3479 +#: noindex-seo.php:5791 +msgid "Recommended settings" +msgstr "" + +#: noindex-seo.php:5793 +msgid "Enables all 5 directives on the 15 contexts flagged \"Recommended\" (privacy policy, date archives, pagination, search results, attachment pages, previews, 404, WooCommerce cart / checkout / my account). Review and save." +msgstr "" + +#: noindex-seo.php:5800 +msgid "Apply Recommended Defaults" +msgstr "" + +#: noindex-seo.php:5805 +msgid "Enable all directives for the 15 contexts flagged as recommended." +msgstr "" + +#: noindex-seo.php:5819 +msgid "Overview" +msgstr "" + +#: noindex-seo.php:5823 +msgid "Total Options" +msgstr "" + +#: noindex-seo.php:5827 +msgid "Enabled" +msgstr "" + +#: noindex-seo.php:5831 +msgid "Recommended to Enable" +msgstr "" + +#: noindex-seo.php:5836 +msgid "Page contexts" +msgstr "" + +#: noindex-seo.php:5841 msgid "Important: Enabling noindex on the wrong pages can harm your search engine rankings. Only enable options you fully understand." msgstr "" -#: noindex-seo.php:3486 +#: noindex-seo.php:5848 msgid "Search options..." msgstr "" -#: noindex-seo.php:3487 +#: noindex-seo.php:5849 msgid "Search options" msgstr "" -#: noindex-seo.php:3512 +#: noindex-seo.php:5874 msgid "This option only works with HTTP Headers implementation method" msgstr "" -#: noindex-seo.php:3521 +#: noindex-seo.php:5883 msgid "Not Recommended" msgstr "" -#: noindex-seo.php:3526 +#: noindex-seo.php:5888 msgid "View Page" msgstr "" -#: assets/js/editor-sidebar.js:103 -msgid "Enable to set custom robots directives for this content" +#: noindex-seo.php:5969 +#: noindex-seo.php:5977 +msgid "Conditional rules" msgstr "" -#: assets/js/editor-sidebar.js:133 -msgid "Robots Directives:" +#: noindex-seo.php:5971 +msgid "Automatically apply noindex to any post whose custom field (for example an ACF field) exactly matches a value. Rules run below the per-post overrides and above the global context settings, and matched posts drop out of the XML sitemap." msgstr "" -#: assets/js/editor-sidebar.js:143 -msgid "Prevent search engines from indexing" +#: noindex-seo.php:5984 +msgid "Field name" msgstr "" -#: assets/js/editor-sidebar.js:158 -msgid "Prevent search engines from following links" +#: noindex-seo.php:5985 +msgid "Value" msgstr "" -#: assets/js/editor-sidebar.js:173 -msgid "Prevent cached versions in search results" +#: noindex-seo.php:5986 +#: noindex-seo.php:6210 +msgid "Actions" +msgstr "" + +#: noindex-seo.php:6002 +msgid "custom_field_name" +msgstr "" + +#: noindex-seo.php:6003 +msgid "value that triggers noindex" +msgstr "" + +#: noindex-seo.php:6004 +#: noindex-seo.php:6231 +msgid "Remove rule" +msgstr "" + +#: noindex-seo.php:6009 +#: noindex-seo.php:6236 +msgid "Add rule" +msgstr "" + +#: noindex-seo.php:6010 +msgid "Up to 20 rules. Rows with an empty field or value are ignored." +msgstr "" + +#. translators: %d: number of posts. +#: noindex-seo.php:6036 +#, php-format +msgid "Imported robots overrides for %d post" +msgid_plural "Imported robots overrides for %d posts" +msgstr[0] "" +msgstr[1] "" + +#. translators: %d: number of terms. +#. translators: %d: number of terms found. +#: noindex-seo.php:6041 +#: noindex-seo.php:6105 +#, php-format +msgid "%d term" +msgid_plural "%d terms" +msgstr[0] "" +msgstr[1] "" + +#. translators: 1: number of skipped posts, 2: number of skipped terms. +#: noindex-seo.php:6052 +#, php-format +msgid "%1$d posts and %2$d terms skipped (already configured)" +msgstr "" + +#: noindex-seo.php:6062 +msgid "No plugins were selected to import from." +msgstr "" + +#: noindex-seo.php:6067 +msgid "The selected plugins had no importable robots data left." +msgstr "" + +#: noindex-seo.php:6073 +msgid "Import from other plugins" +msgstr "" + +#: noindex-seo.php:6075 +msgid "Imports the noindex and nofollow flags stored by other SEO plugins (Yoast SEO, Rank Math, SEOPress, All in One SEO) as per-post and per-term overrides. Nothing is imported automatically: you pick the plugins below and confirm. Content that already has its own override is never touched." +msgstr "" + +#. translators: %d: number of posts found. +#: noindex-seo.php:6094 +#, php-format +msgid "%d post" +msgid_plural "%d posts" +msgstr[0] "" +msgstr[1] "" + +#: noindex-seo.php:6116 +msgid "No importable robots data from other SEO plugins was found on this site." +msgstr "" + +#: noindex-seo.php:6120 +msgid "Import selected plugins" +msgstr "" + +#: noindex-seo.php:6130 +#: noindex-seo.php:6139 +msgid "Export settings" +msgstr "" + +#: noindex-seo.php:6132 +msgid "Download the current settings as a JSON file." +msgstr "" + +#: noindex-seo.php:6148 +#: noindex-seo.php:6156 +#: noindex-seo.php:6166 +msgid "Import settings" +msgstr "" + +#: noindex-seo.php:6150 +msgid "Restore the global settings from a previously exported JSON file. Per-post and per-term overrides are kept." +msgstr "" + +#: noindex-seo.php:6198 +msgid "Extend the virtual robots.txt with bot rules" +msgstr "" + +#: noindex-seo.php:6201 +msgid "Inactive by default. When enabled, the rules below are appended to the robots.txt that WordPress generates virtually — they never replace it. This only applies when WordPress serves robots.txt itself: a physical robots.txt file in the site root, or \"Discourage search engines\" in Reading settings, takes precedence." +msgstr "" + +#: noindex-seo.php:6208 +msgid "User-agent" +msgstr "" + +#: noindex-seo.php:6209 +msgid "Policy" +msgstr "" + +#: noindex-seo.php:6226 +msgid "User-agent token, e.g. GPTBot or *" +msgstr "" + +#: noindex-seo.php:6228 +msgid "Block (Disallow: /)" +msgstr "" + +#: noindex-seo.php:6229 +msgid "Allow (Allow: /)" +msgstr "" + +#: noindex-seo.php:6237 +msgid "Add common AI bots" +msgstr "" + +#: noindex-seo.php:6238 +msgid "Add common search engine bots" +msgstr "" + +#: noindex-seo.php:6241 +msgid "Up to 30 rules. Blocked bots receive \"Disallow: /\" for the whole site; allowed bots receive \"Allow: /\" (useful to allow one crawler inside a broader block set with a * rule). Duplicate user-agents are ignored." +msgstr "" + +#: noindex-seo.php:6247 +msgid "Preview of the appended block" msgstr "" #: assets/js/editor-sidebar.js:188 -msgid "Prevent text snippets in search results" +msgid "Enable to set custom robots directives for this content" msgstr "" -#: assets/js/editor-sidebar.js:237 +#: assets/js/editor-sidebar.js:218 +msgid "Robots Directives:" +msgstr "" + +#: assets/js/editor-sidebar.js:249 msgid "Active Directives:" msgstr "" diff --git a/noindex-seo.php b/noindex-seo.php index 845b80f..5df7333 100644 --- a/noindex-seo.php +++ b/noindex-seo.php @@ -3,9 +3,9 @@ * Plugin Name: noindex SEO * Plugin URI: https://www.robotstxt.software/plugins/noindex-seo/ * Description: Control search engine indexing with robots directives (noindex, nofollow, noarchive, nosnippet, noimageindex) for specific parts of your WordPress site. - * Version: 3.1.5 - * Requires at least: 4.7 - * Requires PHP: 5.6 + * Version: 3.7.0 + * Requires at least: 7.0 + * Requires PHP: 8.3 * Author: ROBOTSTXT * Author URI: https://www.robotstxt.software/ * License: GPL-3.0-or-later @@ -64,8 +64,25 @@ defined( 'ABSPATH' ) || die( 'Bye bye!' ); * oldest tested version and the first with the complete REST * API); nonce verification in the form handlers split into a * capability check plus a standalone check_admin_referer(). + * @since 3.1.6 Admin UI modernization: inline styles replaced with admin + * color-scheme-aware, RTL-ready classes (audit M7); stale + * form-handler wp_die() message corrected (I2); unreachable + * REST fallbacks removed (I5). + * @since 3.5.0 WooCommerce special-page contexts (Cart, Checkout, My + * Account) detected through the page-ID options, and the + * compatibility window narrowed to WordPress 7.0-7.2 and + * PHP 8.3-8.6 (declared floors raised from 4.7 / 5.6). + * @since 3.6.0 Modern robots directives (notranslate, max-snippet, + * max-image-preview, max-video-preview, unavailable_after) on + * every surface (global grid, per-post, per-term, Quick Edit, + * block editor, REST, WP-CLI) and conditional auto-noindex + * rules driven by custom-field (ACF) matches. + * @since 3.7.0 Bridge release: on-demand import of robots overrides from + * other SEO plugins (Yoast, Rank Math, SEOPress, AIOSEO) and + * virtual robots.txt management (bot rules appended to the + * WordPress-generated robots.txt, inactive by default). */ -define( 'NOINDEX_SEO_VERSION', '3.1.5' ); +define( 'NOINDEX_SEO_VERSION', '3.7.0' ); /** * Option key holding the consolidated plugin settings array. @@ -74,6 +91,152 @@ define( 'NOINDEX_SEO_VERSION', '3.1.5' ); */ define( 'NOINDEX_SEO_SETTINGS_KEY', 'noindex_seo_settings' ); +/** + * Returns the boolean robots directives supported by the plugin. + * + * Boolean directives are simple flags: present in the robots output when on + * (1), absent when off (0). + * + * @since 3.6.0 + * + * @return array Directive slugs. + */ +function noindex_seo_get_boolean_directives() { + return array( 'noindex', 'nofollow', 'noarchive', 'nosnippet', 'noimageindex', 'notranslate' ); +} + +/** + * Returns the value-carrying robots directives supported by the plugin. + * + * Value directives render as `name:value` in the robots output. An empty + * string ('') means the directive is off. + * + * @since 3.6.0 + * + * @return array Directive slugs. + */ +function noindex_seo_get_value_directives() { + return array( 'max-snippet', 'max-image-preview', 'max-video-preview', 'unavailable_after' ); +} + +/** + * Returns every robots directive supported by the plugin (boolean + value). + * + * @since 3.6.0 + * + * @return array Directive slugs. + */ +function noindex_seo_get_directives() { + return array_merge( noindex_seo_get_boolean_directives(), noindex_seo_get_value_directives() ); +} + +/** + * Normalizes a raw directive value to its canonical storage form. + * + * Boolean directives normalize to 0 or 1. Value directives normalize to '' + * (off) or their canonical string value: + * + * - max-snippet / max-video-preview: integer >= -1 as a string (-1 = no limit). + * - max-image-preview: 'none', 'standard' or 'large'. + * - unavailable_after: 'Y-m-d H:i' in the site timezone (anything that does + * not parse, including datetime-local 'T' separators are normalized or + * rejected to ''). + * + * Every read path (settings merge, form handling, imports, post/term meta) + * funnels through this function so the storage shape never drifts. + * + * @since 3.6.0 + * + * @param string $directive Directive slug. + * @param mixed $raw Raw value from storage or user input. + * @return int|string 0|1 for boolean directives, ''|string for value directives. + */ +function noindex_seo_normalize_directive_value( $directive, $raw ) { + if ( in_array( $directive, noindex_seo_get_boolean_directives(), true ) ) { + return ( is_scalar( $raw ) && 1 === absint( $raw ) ) ? 1 : 0; + } + + if ( ! is_scalar( $raw ) ) { + return ''; + } + + $value = trim( (string) $raw ); + + if ( in_array( $directive, array( 'max-snippet', 'max-video-preview' ), true ) ) { + if ( ! is_numeric( $value ) ) { + return ''; + } + $int = (int) $value; + return ( $int >= -1 ) ? (string) $int : ''; + } + + if ( 'max-image-preview' === $directive ) { + return in_array( $value, array( 'none', 'standard', 'large' ), true ) ? $value : ''; + } + + if ( 'unavailable_after' === $directive ) { + $value = str_replace( 'T', ' ', $value ); + $dt = date_create_from_format( 'Y-m-d H:i', $value, wp_timezone() ); + return false !== $dt ? $dt->format( 'Y-m-d H:i' ) : ''; + } + + return ''; +} + +/** + * Formats a stored value directive for robots output. + * + * Value directives render as `name:value`; `unavailable_after` additionally + * converts its stored 'Y-m-d H:i' site-time value to the RFC-style datetime + * search engines expect (e.g. `unavailable_after: Wed, 25 Jun 2025 15:00:00 +0200`). + * + * @since 3.6.0 + * + * @param string $directive Directive slug. + * @param string $value Normalized stored value (non-empty). + * @return string Formatted directive token. + */ +function noindex_seo_format_value_directive( $directive, $value ) { + if ( 'unavailable_after' === $directive ) { + $dt = date_create_from_format( 'Y-m-d H:i', $value, wp_timezone() ); + if ( false !== $dt ) { + // RFC 1123-style with a numeric UTC offset ('O'): stable across + // PHP versions, unlike the 'T' abbreviation. + return $directive . ': ' . $dt->format( 'D, d M Y H:i:s O' ); + } + return ''; + } + + return $directive . ':' . $value; +} + +/** + * Formats a directives map for flat-token output (meta tag, HTTP header). + * + * The map keys are directive names; values are `true` (boolean directive) or + * the normalized stored value (value directive). Returns the `name` / + * `name:value` tokens, e.g. `array( 'noindex', 'max-snippet:-1' )`. + * + * @since 3.6.0 + * + * @param array $directives Directive name => true or value. + * @return array Formatted tokens. + */ +function noindex_seo_format_directives( array $directives ) { + $tokens = array(); + foreach ( $directives as $name => $value ) { + if ( true === $value ) { + $tokens[] = $name; + } else { + $token = noindex_seo_format_value_directive( $name, (string) $value ); + if ( '' !== $token ) { + $tokens[] = $token; + } + } + } + return $tokens; +} + /** * Returns the full consolidated settings array, merged with defaults. * @@ -81,21 +244,35 @@ define( 'NOINDEX_SEO_SETTINGS_KEY', 'noindex_seo_settings' ); * * [ * 'version' => 3, - * 'contexts' => [ '' => [ '' => 0|1, ... ], ... ], + * 'contexts' => [ '' => [ '' => 0|1|'', ... ], ... ], + * 'rules' => [ [ 'field' => '', 'value' => '' ], ... ], * 'config' => [ 'method' => 'meta', 'granular' => 0, ... ], * ] * + * Boolean directives store 0|1 and value directives store '' (off) or their + * canonical string value — see noindex_seo_normalize_directive_value(). + * * The array is cached in a static variable per-request after the first read. * * @since 3.0.0 + * @since 3.6.0 Value directives (max-snippet, max-image-preview, + * max-video-preview, unavailable_after, notranslate) joined the + * context grid, and the conditional auto-noindex rules were + * added under the 'rules' key. * * @param bool $force_refresh Optional. Bypass the in-memory cache. Default false. * @return array{ * version: int, - * contexts: array>, + * contexts: array>, + * rules: array, + * robots_txt: array{ + * enabled: int, + * rules: array + * }, * config: array{ * method: string, * granular: int, + * taxonomies_granular: int, * seoplugins: int, * delete_on_uninstall: int * } @@ -109,9 +286,14 @@ function noindex_seo_get_settings( $force_refresh = false ) { } $defaults = array( - 'version' => 3, - 'contexts' => array(), - 'config' => array( + 'version' => 3, + 'contexts' => array(), + 'rules' => array(), + 'robots_txt' => array( + 'enabled' => 0, + 'rules' => array(), + ), + 'config' => array( 'method' => 'meta', 'granular' => 0, 'taxonomies_granular' => 0, @@ -120,15 +302,17 @@ function noindex_seo_get_settings( $force_refresh = false ) { ), ); - // Seed every context × directive combination with 0. + // Seed every context × directive combination: 0 for boolean directives, + // '' (off) for value directives. + $directive_defaults = array(); + foreach ( noindex_seo_get_boolean_directives() as $directive ) { + $directive_defaults[ $directive ] = 0; + } + foreach ( noindex_seo_get_value_directives() as $directive ) { + $directive_defaults[ $directive ] = ''; + } foreach ( noindex_seo_get_contexts() as $context ) { - $defaults['contexts'][ $context ] = array( - 'noindex' => 0, - 'nofollow' => 0, - 'noarchive' => 0, - 'nosnippet' => 0, - 'noimageindex' => 0, - ); + $defaults['contexts'][ $context ] = $directive_defaults; } $saved = get_option( NOINDEX_SEO_SETTINGS_KEY, array() ); @@ -136,18 +320,31 @@ function noindex_seo_get_settings( $force_refresh = false ) { // Merge saved contexts without reordering defaults (so iteration is stable). if ( isset( $saved['contexts'] ) && is_array( $saved['contexts'] ) ) { - foreach ( $defaults['contexts'] as $ctx => $directive_defaults ) { + foreach ( $defaults['contexts'] as $ctx => $ctx_directive_defaults ) { if ( isset( $saved['contexts'][ $ctx ] ) && is_array( $saved['contexts'][ $ctx ] ) ) { $saved_ctx = $saved['contexts'][ $ctx ]; - foreach ( $directive_defaults as $dir => $default_value ) { - $defaults['contexts'][ $ctx ][ $dir ] = isset( $saved_ctx[ $dir ] ) - ? ( is_numeric( $saved_ctx[ $dir ] ) ? (int) $saved_ctx[ $dir ] : $default_value ) + foreach ( $ctx_directive_defaults as $dir => $default_value ) { + $defaults['contexts'][ $ctx ][ $dir ] = array_key_exists( $dir, $saved_ctx ) + ? noindex_seo_normalize_directive_value( $dir, $saved_ctx[ $dir ] ) : $default_value; } } } } + // Conditional auto-noindex rules (3.6.0). + if ( isset( $saved['rules'] ) ) { + $defaults['rules'] = noindex_seo_sanitize_rules( $saved['rules'] ); + } + + // Virtual robots.txt management (3.7.0). + if ( isset( $saved['robots_txt'] ) && is_array( $saved['robots_txt'] ) ) { + $defaults['robots_txt']['enabled'] = empty( $saved['robots_txt']['enabled'] ) ? 0 : 1; + if ( isset( $saved['robots_txt']['rules'] ) ) { + $defaults['robots_txt']['rules'] = noindex_seo_sanitize_robots_txt_rules( $saved['robots_txt']['rules'] ); + } + } + if ( isset( $saved['config'] ) && is_array( $saved['config'] ) ) { foreach ( $defaults['config'] as $key => $default_value ) { if ( ! isset( $saved['config'][ $key ] ) ) { @@ -176,17 +373,705 @@ function noindex_seo_get_settings( $force_refresh = false ) { * Reads a single directive value for a context from the consolidated settings. * * @since 3.0.0 + * @since 3.6.0 Value directives return their normalized string value ('' = off) + * instead of a boolean. * * @param string $context Context slug (e.g. 'single', 'attachment'). - * @param string $directive Directive slug (noindex|nofollow|noarchive|nosnippet|noimageindex). - * @return int 1 if the directive is active for the context, 0 otherwise. + * @param string $directive Directive slug. + * @return int|string 1 for an active boolean directive, 0 for an inactive one, + * or the normalized value ('' = off) of a value directive. */ function noindex_seo_get_setting( $context, $directive ) { $settings = noindex_seo_get_settings(); if ( ! isset( $settings['contexts'][ $context ][ $directive ] ) ) { - return 0; + return in_array( $directive, noindex_seo_get_value_directives(), true ) ? '' : 0; } - return $settings['contexts'][ $context ][ $directive ] ? 1 : 0; + return $settings['contexts'][ $context ][ $directive ]; +} + +/** + * Sanitizes the conditional auto-noindex rules (TODO #11). + * + * Each rule is an exact-match pair: a post meta key (ACF fields and any + * custom field store their values in post meta, so no ACF dependency is + * needed) and the value that triggers noindex. Rules with an empty field or + * value are dropped; at most 20 rules are kept; the plugin's own + * `_noindex_seo_` meta keys are not valid rule fields (they are the output + * of the plugin, not content data). + * + * @since 3.6.0 + * + * @param mixed $raw Untrusted rules array (from storage, form or import). + * @return array Sanitized rules. + */ +function noindex_seo_sanitize_rules( $raw ) { + if ( ! is_array( $raw ) ) { + return array(); + } + + $rules = array(); + foreach ( $raw as $rule ) { + if ( ! is_array( $rule ) || ! isset( $rule['field'], $rule['value'] ) ) { + continue; + } + + $field = is_scalar( $rule['field'] ) ? (string) preg_replace( '/[^A-Za-z0-9_-]/', '', (string) $rule['field'] ) : ''; + $value = is_scalar( $rule['value'] ) ? sanitize_text_field( (string) $rule['value'] ) : ''; + + if ( '' === $field || '' === $value || 0 === strpos( $field, '_noindex_seo_' ) ) { + continue; + } + + $rules[] = array( + 'field' => $field, + 'value' => $value, + ); + + if ( count( $rules ) >= 20 ) { + break; + } + } + + return $rules; +} + +/** + * Returns the first auto-noindex rule matching a post's meta, if any. + * + * A rule matches when the post's meta value for the rule field is exactly + * equal (string comparison) to the rule value. The plugin's own + * `_noindex_seo_` meta keys never match, even if a rule slipped through + * sanitization. + * + * @since 3.6.0 + * + * @param int $post_id Post ID. + * @return array{field: string, value: string}|null The matching rule, or null. + */ +function noindex_seo_matching_rule_for_post( $post_id ) { + $post_id = absint( $post_id ); + if ( ! $post_id ) { + return null; + } + + foreach ( noindex_seo_get_settings()['rules'] as $rule ) { + if ( 0 === strpos( $rule['field'], '_noindex_seo_' ) ) { + continue; + } + + $meta = get_post_meta( $post_id, $rule['field'], true ); + if ( is_scalar( $meta ) && (string) $meta === $rule['value'] ) { + return $rule; + } + } + + return null; +} + +/** + * Sanitizes the virtual robots.txt bot rules (3.7.0). + * + * Each rule is a `user_agent` string (letters, digits, `-`, `_`, `.`, `/`, + * `*` — the characters valid in a robots.txt User-agent token) plus a policy + * of `block` (Disallow: /) or `allow` (Allow: /). Empty agents are dropped, + * duplicates collapse (first policy wins) and at most 30 rules are kept. + * + * @since 3.7.0 + * + * @param mixed $raw Untrusted rules array. + * @return array Sanitized rules. + */ +function noindex_seo_sanitize_robots_txt_rules( $raw ) { + if ( ! is_array( $raw ) ) { + return array(); + } + + $rules = array(); + $seen = array(); + foreach ( $raw as $rule ) { + if ( ! is_array( $rule ) || ! isset( $rule['user_agent'], $rule['policy'] ) ) { + continue; + } + + $agent = is_scalar( $rule['user_agent'] ) ? preg_replace( '/[^A-Za-z0-9_*.\-\/]/', '', (string) $rule['user_agent'] ) : ''; + $agent = trim( substr( (string) $agent, 0, 100 ), " \t\0\x0B-_." ); // Length-capped; a lone '*' (all crawlers) stays valid. + if ( '' === $agent || isset( $seen[ strtolower( $agent ) ] ) ) { + continue; + } + + $policy = ( 'allow' === $rule['policy'] ) ? 'allow' : 'block'; + + $seen[ strtolower( $agent ) ] = true; + $rules[] = array( + 'user_agent' => $agent, + 'policy' => $policy, + ); + + if ( count( $rules ) >= 30 ) { + break; + } + } + + return $rules; +} + +/** + * Returns the well-known AI crawler User-agent tokens for the preset button. + * + * Source: public crawler documentation of the main AI vendors (OpenAI, + * Anthropic, Google, Perplexity, Amazon, Meta, Apple, Common Crawl, Cohere, + * ByteDance). Filterable so the list can track new crawlers without a release. + * + * @since 3.7.0 + * + * @return array User-agent tokens. + */ +function noindex_seo_get_ai_bots() { + /** + * Filter the AI crawler User-agent tokens offered by the preset button. + * + * @since 3.7.0 + * + * @param array $bots User-agent tokens. + */ + return apply_filters( + 'noindex_seo_ai_bots', + array( + 'GPTBot', + 'ChatGPT-User', + 'OAI-SearchBot', + 'ClaudeBot', + 'Claude-User', + 'anthropic-ai', + 'Google-Extended', + 'PerplexityBot', + 'Amazonbot', + 'meta-externalagent', + 'Applebot-Extended', + 'CCBot', + 'cohere-ai', + 'Bytespider', + 'YouBot', + ) + ); +} + +/** + * Returns the well-known search engine crawler User-agent tokens. + * + * @since 3.7.0 + * + * @return array User-agent tokens. + */ +function noindex_seo_get_search_bots() { + /** + * Filter the search engine crawler User-agent tokens offered by the preset button. + * + * @since 3.7.0 + * + * @param array $bots User-agent tokens. + */ + return apply_filters( + 'noindex_seo_search_bots', + array( + 'Googlebot', + 'Bingbot', + 'DuckDuckBot', + 'Slurp', + 'Baiduspider', + 'YandexBot', + ) + ); +} + +/** + * Returns the robots.txt block the plugin appends, or '' when inactive. + * + * Each rule renders as its own `User-agent: ` group: + * + * User-agent: GPTBot + * Disallow: / + * + * `allow` rules render `Allow: /` so they can override a broader block + * (the last matching group wins in most crawlers' implementations). + * + * @since 3.7.0 + * + * @return string Robots.txt snippet (no trailing newline), '' when disabled or empty. + */ +function noindex_seo_get_robots_txt_block() { + $settings = noindex_seo_get_settings(); + + if ( empty( $settings['robots_txt']['enabled'] ) ) { + return ''; + } + + $lines = array(); + foreach ( $settings['robots_txt']['rules'] as $rule ) { + $lines[] = 'User-agent: ' . $rule['user_agent']; + $lines[] = ( 'allow' === $rule['policy'] ) ? 'Allow: /' : 'Disallow: /'; + $lines[] = ''; + } + + return trim( implode( "\n", $lines ) ); +} + +/** + * Extends the virtual robots.txt generated by WordPress with the configured + * bot rules (3.7.0). + * + * Inactive by default; only appends when the feature is enabled and rules + * exist. This extends — never replaces — the core output, and only applies + * when WordPress serves robots.txt virtually (no physical robots.txt file + * in the site root and "Search engines visibility" allowed). + * + * Hooked to the {@see 'robots_txt'} filter. + * + * @since 3.7.0 + * + * @param string $output Robots.txt output so far. + * @return string Filtered output. + */ +function noindex_seo_filter_robots_txt( $output ) { + $block = noindex_seo_get_robots_txt_block(); + + if ( '' === $block ) { + return $output; + } + + return $output . "\n\n" . $block; +} +add_filter( 'robots_txt', 'noindex_seo_filter_robots_txt' ); + +/** + * Returns the supported import sources: other SEO plugins whose robots + * directive data noindex SEO can import (3.7.0, spec section 5). + * + * Each source declares how to read its per-post (and, where stored, per-term) + * noindex / nofollow flags: + * + * - `is` => exact meta value match (e.g. Yoast stores '1'). + * - `has` => the value contains the token (Rank Math stores a serialized + * array of directive names). + * + * Sources are data-driven so third parties can register or correct one via + * the filter. Only the two directives every source shares (noindex, + * nofollow) are imported; anything richer stays for the importing plugin's + * own UI. + * + * @since 3.7.0 + * + * @return array Source registry. + */ +function noindex_seo_get_import_sources() { + $sources = array( + 'yoast' => array( + 'label' => 'Yoast SEO', + 'posts' => array( + 'noindex' => array( + 'key' => '_yoast_wpseo_meta-robots-noindex', + 'is' => '1', + ), + 'nofollow' => array( + 'key' => '_yoast_wpseo_meta-robots-nofollow', + 'is' => '1', + ), + ), + 'terms' => array( + 'noindex' => array( + 'key' => '_yoast_wpseo_meta-robots-noindex', + 'is' => '1', + ), + 'nofollow' => array( + 'key' => '_yoast_wpseo_meta-robots-nofollow', + 'is' => '1', + ), + ), + ), + 'rankmath' => array( + 'label' => 'Rank Math SEO', + 'posts' => array( + 'noindex' => array( + 'key' => 'rank_math_robots', + 'has' => 'noindex', + ), + 'nofollow' => array( + 'key' => 'rank_math_robots', + 'has' => 'nofollow', + ), + ), + 'terms' => array( + 'noindex' => array( + 'key' => 'rank_math_robots', + 'has' => 'noindex', + ), + 'nofollow' => array( + 'key' => 'rank_math_robots', + 'has' => 'nofollow', + ), + ), + ), + 'seopress' => array( + 'label' => 'SEOPress', + 'posts' => array( + 'noindex' => array( + 'key' => '_seopress_robots_index', + 'is' => 'no', + ), + 'nofollow' => array( + 'key' => '_seopress_robots_follow', + 'is' => 'no', + ), + ), + ), + 'aioseo' => array( + 'label' => 'All in One SEO', + 'posts' => array( + 'noindex' => array( + 'key' => '_aioseop_noindex', + 'is' => 'on', + ), + 'nofollow' => array( + 'key' => '_aioseop_nofollow', + 'is' => 'on', + ), + ), + ), + ); + + /** + * Filter the importable SEO plugin sources. + * + * @since 3.7.0 + * + * @param array $sources Source registry (see noindex_seo_get_import_sources()). + */ + return apply_filters( 'noindex_seo_import_sources', $sources ); +} + +/** + * Builds the meta_query clause that finds content flagged by a source. + * + * @since 3.7.0 + * + * @param array> $flags noindex / nofollow flag specs of one source. + * @return array> meta_query clauses (unkeyed; caller wraps with OR). + */ +function noindex_seo_import_flags_meta_query( array $flags ) { + $clauses = array(); + foreach ( $flags as $spec ) { + if ( isset( $spec['is'] ) ) { + $clauses[] = array( + 'key' => $spec['key'], + 'value' => $spec['is'], + 'compare' => '=', + ); + } elseif ( isset( $spec['has'] ) ) { + $clauses[] = array( + 'key' => $spec['key'], + 'value' => $spec['has'], + 'compare' => 'LIKE', + ); + } + } + return $clauses; +} + +/** + * Returns the shared post-type and status coverage for finding posts flagged + * by a source. + * + * Attachments (status `inherit`) and CPTs that hide from search must be + * included: 'post_type' => 'any' would silently exclude both, and SEO + * plugins do store flags on media. + * + * @since 3.7.0 + * + * @return array{post_types: array, post_statuses: array} Coverage lists. + */ +function noindex_seo_import_posts_coverage() { + return array( + 'post_types' => array_values( get_post_types( array( 'show_ui' => true ), 'names' ) ), + 'post_statuses' => array( 'publish', 'draft', 'pending', 'private', 'future', 'inherit' ), + ); +} + +/** + * Counts the importable posts and terms per source. + * + * Detection is data-driven, not activation-driven: leftover meta from an + * uninstalled SEO plugin still counts (that is exactly the migration case). + * The counts are cached in a 15-minute transient because the LIKE-based + * meta scans are not free on large sites; noindex_seo_run_import() + * invalidates the cache after an import. + * + * @since 3.7.0 + * + * @return array Counts per source slug. + */ +function noindex_seo_count_import_sources() { + $cached = get_transient( 'noindex_seo_import_counts' ); + if ( is_array( $cached ) ) { + // Transients can hold stale or foreign shapes: validate per row. + $valid = array(); + foreach ( $cached as $slug => $row ) { + if ( is_string( $slug ) && is_array( $row ) && isset( $row['label'], $row['posts'], $row['terms'] ) ) { + $valid[ $slug ] = array( + 'label' => (string) $row['label'], + 'posts' => (int) $row['posts'], + 'terms' => (int) $row['terms'], + ); + } + } + if ( array() !== $valid ) { + return $valid; + } + } + + $counts = array(); + $coverage = noindex_seo_import_posts_coverage(); + + foreach ( noindex_seo_get_import_sources() as $slug => $source ) { + $found = get_posts( + array( + 'post_type' => $coverage['post_types'], + 'post_status' => $coverage['post_statuses'], + 'fields' => 'ids', + 'posts_per_page' => -1, + 'no_found_rows' => true, + 'suppress_filters' => true, + 'meta_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query + array_merge( array( 'relation' => 'OR' ), noindex_seo_import_flags_meta_query( $source['posts'] ) ), + ), + ) + ); + + $term_count = 0; + if ( isset( $source['terms'] ) ) { + $terms = get_terms( + array( + 'taxonomy' => get_taxonomies( array( 'public' => true ), 'names' ), + 'hide_empty' => false, + 'fields' => 'ids', + 'meta_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query + array_merge( array( 'relation' => 'OR' ), noindex_seo_import_flags_meta_query( $source['terms'] ) ), + ), + ) + ); + $term_count = is_array( $terms ) ? count( $terms ) : 0; + } + + $counts[ $slug ] = array( + 'label' => $source['label'], + 'posts' => count( $found ), + 'terms' => $term_count, + ); + } + + set_transient( 'noindex_seo_import_counts', $counts, 15 * MINUTE_IN_SECONDS ); + + return $counts; +} + +/** + * Reads one flag of a source from a raw meta value. + * + * @since 3.7.0 + * + * @param mixed $meta_value Raw meta value. + * @param array $spec Flag spec (key + is|has). + * @return bool True when the source flag is on. + */ +function noindex_seo_source_flag_is_on( $meta_value, array $spec ) { + if ( isset( $spec['is'] ) ) { + return is_scalar( $meta_value ) && (string) $meta_value === $spec['is']; + } + + if ( isset( $spec['has'] ) && is_scalar( $spec['has'] ) ) { + $token = (string) $spec['has']; + if ( is_string( $meta_value ) ) { + return false !== strpos( $meta_value, $token ); + } + if ( is_array( $meta_value ) ) { + return in_array( $token, $meta_value, true ); + } + } + + return false; +} + +/** + * Imports the robots overrides of the given sources (3.7.0, spec section 5). + * + * Rules, per the specification: + * + * - On-demand: only runs when the user asked for it. + * - Never overwrites: content that already carries a `_noindex_seo_override` + * meta row (even an "off" one) is skipped and counted. + * - Only the shared noindex / nofollow booleans are imported; they become + * granular per-post / per-term overrides with the override flag set. + * + * @since 3.7.0 + * + * @param array $slugs Source slugs to import. + * @return array{posts: int, terms: int, skipped_posts: int, skipped_terms: int} Totals across sources. + */ +function noindex_seo_run_import( array $slugs ) { + $totals = array( + 'posts' => 0, + 'terms' => 0, + 'skipped_posts' => 0, + 'skipped_terms' => 0, + ); + + $sources = noindex_seo_get_import_sources(); + + foreach ( $slugs as $slug ) { + if ( ! isset( $sources[ $slug ] ) ) { + continue; + } + $source = $sources[ $slug ]; + + // Posts. + $coverage = noindex_seo_import_posts_coverage(); + $post_ids = get_posts( + array( + 'post_type' => $coverage['post_types'], + 'post_status' => $coverage['post_statuses'], + 'fields' => 'ids', + 'posts_per_page' => -1, + 'no_found_rows' => true, + 'suppress_filters' => true, + 'meta_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query + array_merge( array( 'relation' => 'OR' ), noindex_seo_import_flags_meta_query( $source['posts'] ) ), + ), + ) + ); + + foreach ( (array) $post_ids as $post_id ) { + $post_id = (int) $post_id; + // Never overwrite existing data (an explicit "off" row counts as data too). + if ( metadata_exists( 'post', $post_id, '_noindex_seo_override' ) ) { + ++$totals['skipped_posts']; + continue; + } + + $noindex = noindex_seo_source_flag_is_on( get_post_meta( $post_id, $source['posts']['noindex']['key'], true ), $source['posts']['noindex'] ); + $nofollow = noindex_seo_source_flag_is_on( get_post_meta( $post_id, $source['posts']['nofollow']['key'], true ), $source['posts']['nofollow'] ); + + if ( ! $noindex && ! $nofollow ) { + continue; // False positive of the LIKE query: nothing to import. + } + + update_post_meta( $post_id, '_noindex_seo_override', 1 ); + update_post_meta( $post_id, '_noindex_seo_noindex', $noindex ? 1 : 0 ); + update_post_meta( $post_id, '_noindex_seo_nofollow', $nofollow ? 1 : 0 ); + ++$totals['posts']; + } + + // Terms (only sources that store term meta). + if ( isset( $source['terms'] ) ) { + $term_ids = get_terms( + array( + 'taxonomy' => get_taxonomies( array( 'public' => true ), 'names' ), + 'hide_empty' => false, + 'fields' => 'ids', + 'meta_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query + array_merge( array( 'relation' => 'OR' ), noindex_seo_import_flags_meta_query( $source['terms'] ) ), + ), + ) + ); + + foreach ( is_array( $term_ids ) ? $term_ids : array() as $term_id ) { + if ( metadata_exists( 'term', $term_id, '_noindex_seo_override' ) ) { + ++$totals['skipped_terms']; + continue; + } + + $noindex = noindex_seo_source_flag_is_on( get_term_meta( $term_id, $source['terms']['noindex']['key'], true ), $source['terms']['noindex'] ); + $nofollow = noindex_seo_source_flag_is_on( get_term_meta( $term_id, $source['terms']['nofollow']['key'], true ), $source['terms']['nofollow'] ); + + if ( ! $noindex && ! $nofollow ) { + continue; + } + + update_term_meta( $term_id, '_noindex_seo_override', 1 ); + update_term_meta( $term_id, '_noindex_seo_noindex', $noindex ? 1 : 0 ); + update_term_meta( $term_id, '_noindex_seo_nofollow', $nofollow ? 1 : 0 ); + ++$totals['terms']; + } + } + } + + // The counts shown on the Tools tab describe pre-import state: drop them. + delete_transient( 'noindex_seo_import_counts' ); + + return $totals; +} + +/** + * Collects the active directive map stored in a post's granular meta. + * + * Boolean directives that are on map to `true`; value directives map to their + * normalized value (absent when off). + * + * @since 3.6.0 + * + * @param int $post_id Post ID. + * @return array Directive name => true or value. + */ +function noindex_seo_get_post_directives_map( $post_id ) { + $post_id = absint( $post_id ); + $map = array(); + if ( ! $post_id ) { + return $map; + } + + foreach ( noindex_seo_get_boolean_directives() as $directive ) { + $meta_value = get_post_meta( $post_id, '_noindex_seo_' . $directive, true ); + if ( is_scalar( $meta_value ) && 1 === absint( $meta_value ) ) { + $map[ $directive ] = true; + } + } + foreach ( noindex_seo_get_value_directives() as $directive ) { + $meta_value = get_post_meta( $post_id, '_noindex_seo_' . $directive, true ); + $value = is_scalar( $meta_value ) ? noindex_seo_normalize_directive_value( $directive, $meta_value ) : ''; + if ( '' !== $value ) { + $map[ $directive ] = $value; + } + } + + return $map; +} + +/** + * Collects the active directive map configured for a context. + * + * @since 3.6.0 + * + * @param string $context Context slug. + * @return array Directive name => true or value. + */ +function noindex_seo_get_context_directives_map( $context ) { + $map = array(); + + foreach ( noindex_seo_get_boolean_directives() as $directive ) { + if ( 1 === noindex_seo_get_setting( $context, $directive ) ) { + $map[ $directive ] = true; + } + } + foreach ( noindex_seo_get_value_directives() as $directive ) { + $value = noindex_seo_get_setting( $context, $directive ); + if ( '' !== $value ) { + $map[ $directive ] = $value; + } + } + + return $map; } /** @@ -244,32 +1129,65 @@ function noindex_seo_update_settings( array $settings ) { * printed as a classic tag on wp_head when * the wp_robots API is not available, so the plugin works from * WordPress 4.0 again. + * @since 3.6.0 The $directives argument is now a map of directive name => + * true (boolean directive) or the normalized string value + * (value directive), so value-carrying directives such as + * `max-snippet` render as `max-snippet:-1`. Flat lists of + * boolean names passed by third-party code still work. * * @see https://developer.wordpress.org/reference/hooks/wp_robots/ * @see https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag * - * @param string $method Implementation method: 'meta', 'header', or 'both'. Default 'meta'. - * @param array $directives Array of directives to apply. Default array('noindex'). + * @param string $method Implementation method: 'meta', 'header', or 'both'. Default 'meta'. + * @param array $directives Directive map (name => true or value), or a flat + * list of boolean names (pre-3.6.0 convention). + * Default array('noindex' => true). * @return void */ -function noindex_seo_metarobots( $method = 'meta', array $directives = array( 'noindex' ) ) { +function noindex_seo_metarobots( $method = 'meta', array $directives = array( 'noindex' => true ) ) { // Sanitize method. $valid_methods = array( 'meta', 'header', 'both' ); $method = in_array( $method, $valid_methods, true ) ? $method : 'meta'; - // Sanitize directives. - $valid_directives = array( 'noindex', 'nofollow', 'noarchive', 'nosnippet', 'noimageindex' ); - $directives = array_intersect( $directives, $valid_directives ); + // Normalize the directives map: accept a flat list of boolean names + // (pre-3.6.0 calling convention) and drop unknown directives. + $valid_directives = noindex_seo_get_directives(); + $map = array(); + foreach ( $directives as $name => $value ) { + if ( is_int( $name ) && is_string( $value ) ) { + // Flat list: sequential names. + $name = $value; + $value = true; + } + if ( ! in_array( $name, $valid_directives, true ) ) { + continue; + } + if ( in_array( $name, noindex_seo_get_boolean_directives(), true ) ) { + // absint( true ) === 1, so a single check covers both. + if ( 1 === absint( $value ) ) { + $map[ $name ] = true; + } + } else { + $value = noindex_seo_normalize_directive_value( $name, $value ); + if ( '' !== $value ) { + $map[ $name ] = $value; + } + } + } + $directives = $map; if ( empty( $directives ) ) { return; // No valid directives to apply. } + // Flat tokens (header value and classic meta tag). + $tokens = noindex_seo_format_directives( $directives ); + // Send HTTP header if requested. $header_sent = false; if ( in_array( $method, array( 'header', 'both' ), true ) ) { if ( ! headers_sent() ) { - $header_value = implode( ', ', $directives ); + $header_value = implode( ', ', $tokens ); header( 'X-Robots-Tag: ' . $header_value, false ); $header_sent = true; } @@ -286,12 +1204,11 @@ function noindex_seo_metarobots( $method = 'meta', array $directives = array( 'n if ( function_exists( 'wp_robots' ) ) { // WordPress 5.7+: inject the directives into the core robots API. // On WordPress older than 5.7 the wp_robots filter does not exist and the classic wp_head output below is used instead. - /* @phpstan-ignore WPCompat.filterNotAvailable.wprobots */ add_filter( 'wp_robots', function ( array $robots ) use ( $directives ) { - foreach ( $directives as $directive ) { - $robots[ $directive ] = true; + foreach ( $directives as $name => $value ) { + $robots[ $name ] = ( true === $value ) ? true : $value; } return $robots; }, @@ -304,8 +1221,8 @@ function noindex_seo_metarobots( $method = 'meta', array $directives = array( 'n // WordPress 4.0 - 5.6: classic tag on wp_head. add_action( 'wp_head', - function () use ( $directives ) { - echo '' . "\n"; + function () use ( $tokens ) { + echo '' . "\n"; }, 1 // Early, so the tag sits near the top of the head like core output. ); @@ -323,8 +1240,7 @@ function noindex_seo_metarobots( $method = 'meta', array $directives = array( 'n * @return void */ function noindex_seo_clear_post_directives( $post_id ) { - $directives = array( 'noindex', 'nofollow', 'noarchive', 'nosnippet', 'noimageindex' ); - foreach ( $directives as $directive ) { + foreach ( noindex_seo_get_directives() as $directive ) { delete_post_meta( $post_id, '_noindex_seo_' . $directive ); } } @@ -367,6 +1283,9 @@ function noindex_seo_show() { 'noindex_seo_contexts', array( 'single' => 'noindex_seo_single', + 'woo_cart' => 'noindex_seo_woo_cart', + 'woo_checkout' => 'noindex_seo_woo_checkout', + 'woo_myaccount' => 'noindex_seo_woo_myaccount', 'page' => 'noindex_seo_page', 'privacy_policy' => 'noindex_seo_privacy_policy', 'attachment' => 'noindex_seo_attachment', @@ -412,17 +1331,8 @@ function noindex_seo_show() { if ( $post_id ) { $override = get_post_meta( $post_id, '_noindex_seo_override', true ); if ( $override ) { - // Collect active directives from post meta. - $post_directives = array(); - $available_directives = array( 'noindex', 'nofollow', 'noarchive', 'nosnippet', 'noimageindex' ); - - foreach ( $available_directives as $directive ) { - $meta_value = get_post_meta( $post_id, '_noindex_seo_' . $directive, true ); - // Explicitly check for 1 or '1' to avoid false positives with '0' string. - if ( is_scalar( $meta_value ) && 1 === absint( $meta_value ) ) { - $post_directives[] = $directive; - } - } + // Collect active directives (booleans and values) from post meta. + $post_directives = noindex_seo_get_post_directives_map( $post_id ); // Apply post-specific directives if any are enabled. if ( ! empty( $post_directives ) ) { @@ -445,13 +1355,19 @@ function noindex_seo_show() { if ( $term_id ) { $term_override = get_term_meta( $term_id, '_noindex_seo_override', true ); if ( $term_override ) { - $term_directives = array(); - $available_directives = array( 'noindex', 'nofollow', 'noarchive', 'nosnippet', 'noimageindex' ); + $term_directives = array(); - foreach ( $available_directives as $directive ) { + foreach ( noindex_seo_get_boolean_directives() as $directive ) { $meta_value = get_term_meta( $term_id, '_noindex_seo_' . $directive, true ); if ( is_scalar( $meta_value ) && 1 === absint( $meta_value ) ) { - $term_directives[] = $directive; + $term_directives[ $directive ] = true; + } + } + foreach ( noindex_seo_get_value_directives() as $directive ) { + $meta_value = get_term_meta( $term_id, '_noindex_seo_' . $directive, true ); + $value = is_scalar( $meta_value ) ? noindex_seo_normalize_directive_value( $directive, $meta_value ) : ''; + if ( '' !== $value ) { + $term_directives[ $directive ] = $value; } } @@ -465,6 +1381,21 @@ function noindex_seo_show() { } } + // PRIORITY 1.55: Conditional auto-noindex rules (3.6.0). + // A rule match applies noindex to the singular content being viewed — + // more specific than the per-CPT and global context defaults, less + // specific than an explicit per-post override (PRIORITY 1, which already + // returned above when active). + if ( is_singular() ) { + $matched_rule = noindex_seo_matching_rule_for_post( get_queried_object_id() ); + if ( null !== $matched_rule ) { + $opt = noindex_seo_get_config( 'method', 'meta' ); + $implementation_method = is_string( $opt ) ? $opt : 'meta'; + noindex_seo_metarobots( $implementation_method, array( 'noindex' => true ) ); + return; + } + } + // PRIORITY 1.6: Per-CPT global defaults. // When the current request is a single from a public custom post type that // has at least one directive configured in its `cpt_{post_type}` context, @@ -475,15 +1406,8 @@ function noindex_seo_show() { if ( is_singular() ) { $post_type = get_post_type(); if ( $post_type && 'post' !== $post_type && 'page' !== $post_type && 'attachment' !== $post_type ) { - $cpt_context = 'cpt_' . $post_type; - $cpt_directives = array(); - $cpt_directive_list = array( 'noindex', 'nofollow', 'noarchive', 'nosnippet', 'noimageindex' ); - - foreach ( $cpt_directive_list as $directive ) { - if ( 1 === noindex_seo_get_setting( $cpt_context, $directive ) ) { - $cpt_directives[] = $directive; - } - } + $cpt_context = 'cpt_' . $post_type; + $cpt_directives = noindex_seo_get_context_directives_map( $cpt_context ); if ( ! empty( $cpt_directives ) ) { $opt = noindex_seo_get_config( 'method', 'meta' ); @@ -498,8 +1422,8 @@ function noindex_seo_show() { // Try to get the options from the transient. $options = get_transient( 'noindex_seo_options' ); - // Available directives. - $available_directives = array( 'noindex', 'nofollow', 'noarchive', 'nosnippet', 'noimageindex' ); + // Available directives (booleans and value-carrying, 3.6.0). + $available_directives = noindex_seo_get_directives(); if ( false === $options || ! is_array( $options ) || empty( $options ) ) { // Transient not set; pull directive values from the consolidated settings. @@ -525,8 +1449,16 @@ function noindex_seo_show() { // However, this catch-all condition is kept for edge cases, custom implementations, or future // WordPress versions that might introduce new date archive types not covered by the specific functions. // While this condition may rarely (or never) be true in practice, it provides defensive coverage. + // WooCommerce special pages (Cart, Checkout, My Account) are regular + // pages; resolve them once so their dedicated contexts can run before + // the generic 'page' context. + $woo_context = is_page() ? noindex_seo_get_woo_context_for_page( get_queried_object_id() ) : ''; + $current_conditions = array( 'single' => is_single(), + 'woo_cart' => 'woo_cart' === $woo_context, + 'woo_checkout' => 'woo_checkout' === $woo_context, + 'woo_myaccount' => 'woo_myaccount' === $woo_context, 'page' => is_page(), 'attachment' => is_attachment(), 'privacy_policy' => function_exists( 'is_privacy_policy' ) && is_privacy_policy(), @@ -561,15 +1493,18 @@ function noindex_seo_show() { isset( $current_conditions[ $context ] ) && $current_conditions[ $context ] ) { - // Collect all active directives for this context. + // Collect all active directives for this context: booleans map to + // true, value directives keep their cached string value. $active_directives = array(); foreach ( $available_directives as $directive ) { $directive_key = str_replace( 'noindex', $directive, (string) $option_key ); - if ( isset( $options[ $directive_key ] ) && (bool) $options[ $directive_key ] ) { - $active_directives[] = $directive; + if ( ! isset( $options[ $directive_key ] ) || '' === $options[ $directive_key ] || 0 === $options[ $directive_key ] ) { + continue; } + + $active_directives[ $directive ] = is_string( $options[ $directive_key ] ) ? $options[ $directive_key ] : true; } // Apply directives if any are active. @@ -816,6 +1751,10 @@ function noindex_seo_load_textdomain() { * - 'page' → applies to the built-in `page` post type. * - 'attachment'→ applies to the built-in `attachment` post type. * - 'cpt_{type}'→ applies to that custom post type (3.1.0+). + * 1.5. WooCommerce special pages (cart / checkout / my account, 3.5.0+): + * when their dedicated contexts have `noindex=1`, the specific page IDs + * are dropped from the pages sitemap even if the 'page' context is not + * noindexed. * 2. Per-post exclusion: if granular control is on, individual posts that * have `_noindex_seo_override=1` AND `_noindex_seo_noindex=1` in postmeta * are added to `post__not_in`. @@ -853,8 +1792,54 @@ function noindex_seo_filter_sitemap_posts( array $args, $post_type ) { return $args; } - // Layer 2: per-post exclusion via granular override. + // Layer 1.5: WooCommerce special pages. They belong to the 'page' post + // type but can carry their own dedicated contexts, so drop them from + // the pages sitemap when those contexts are noindexed (WP 3.5.0+). + if ( 'page' === $post_type ) { + $woo_excluded = array(); + foreach ( noindex_seo_get_woo_context_options() as $woo_context => $woo_option ) { + if ( 1 !== noindex_seo_get_setting( $woo_context, 'noindex' ) ) { + continue; + } + $woo_page_id = get_option( $woo_option, 0 ); + if ( is_numeric( $woo_page_id ) && (int) $woo_page_id > 0 ) { + $woo_excluded[] = (int) $woo_page_id; + } + } + if ( ! empty( $woo_excluded ) ) { + $existing = isset( $args['post__not_in'] ) && is_array( $args['post__not_in'] ) ? $args['post__not_in'] : array(); + $args['post__not_in'] = array_merge( $existing, $woo_excluded ); + } + } + + // Layer 2: per-post exclusion via granular override or conditional rules. + // Rule matches (3.6.0) always mean noindex, so they join the exclusion + // query directly; the granular override only excludes when its noindex + // directive is on. + $meta_query = array( 'relation' => 'OR' ); + if ( noindex_seo_get_config( 'granular', 0 ) ) { + $meta_query[] = array( + 'relation' => 'AND', + array( + 'key' => '_noindex_seo_override', + 'value' => 1, + ), + array( + 'key' => '_noindex_seo_noindex', + 'value' => 1, + ), + ); + } + + foreach ( noindex_seo_get_settings()['rules'] as $rule ) { + $meta_query[] = array( + 'key' => $rule['field'], + 'value' => $rule['value'], + ); + } + + if ( count( $meta_query ) > 1 ) { $excluded = get_posts( array( 'post_type' => $post_type, @@ -862,17 +1847,7 @@ function noindex_seo_filter_sitemap_posts( array $args, $post_type ) { 'nopaging' => true, 'suppress_filters' => false, 'no_found_rows' => true, - 'meta_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query - 'relation' => 'AND', - array( - 'key' => '_noindex_seo_override', - 'value' => 1, - ), - array( - 'key' => '_noindex_seo_noindex', - 'value' => 1, - ), - ), + 'meta_query' => $meta_query, // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query ) ); @@ -885,7 +1860,6 @@ function noindex_seo_filter_sitemap_posts( array $args, $post_type ) { return $args; } // The hook only exists on WP 5.5+; on older versions the filter simply never fires. -/* @phpstan-ignore WPCompat.filterNotAvailable.wpsitemapspostsqueryargs */ add_filter( 'wp_sitemaps_posts_query_args', 'noindex_seo_filter_sitemap_posts', 10, 2 ); /** @@ -952,7 +1926,6 @@ function noindex_seo_filter_sitemap_taxonomies( array $args, $taxonomy ) { return $args; } // The hook only exists on WP 5.5+; on older versions the filter simply never fires. -/* @phpstan-ignore WPCompat.filterNotAvailable.wpsitemapstaxonomiesqueryargs */ add_filter( 'wp_sitemaps_taxonomies_query_args', 'noindex_seo_filter_sitemap_taxonomies', 10, 2 ); /** @@ -978,7 +1951,6 @@ function noindex_seo_filter_sitemap_users( array $args ) { return $args; } // The hook only exists on WP 5.5+; on older versions the filter simply never fires. -/* @phpstan-ignore WPCompat.filterNotAvailable.wpsitemapsusersqueryargs */ add_filter( 'wp_sitemaps_users_query_args', 'noindex_seo_filter_sitemap_users' ); /** @@ -1062,11 +2034,10 @@ add_action( 'rest_api_init', 'noindex_seo_register_rest_routes' ); */ function noindex_seo_rest_settings_permission_check() { if ( ! current_user_can( 'manage_options' ) ) { - $status = function_exists( 'rest_authorization_required_code' ) ? rest_authorization_required_code() : 401; return new WP_Error( 'noindex_seo_rest_forbidden', __( 'You do not have permission to read the noindex SEO settings.', 'noindex-seo' ), - array( 'status' => $status ) + array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -1113,11 +2084,10 @@ function noindex_seo_rest_effective_permission_check( WP_REST_Request $request ) // Everything else requires edit permission for the specific post. if ( ! current_user_can( 'edit_post', $post->ID ) ) { - $status = function_exists( 'rest_authorization_required_code' ) ? rest_authorization_required_code() : 401; return new WP_Error( 'noindex_seo_rest_forbidden', __( 'You do not have permission to read directives for this post.', 'noindex-seo' ), - array( 'status' => $status ) + array( 'status' => rest_authorization_required_code() ) ); } @@ -1128,9 +2098,9 @@ function noindex_seo_rest_effective_permission_check( WP_REST_Request $request ) * REST callback: returns the consolidated settings array. * * Strips the internal `version` key — that is an implementation detail that - * callers should not depend on. Everything else (contexts, config) is exposed - * verbatim so headless consumers can replicate the directive logic on their - * own front-end. + * callers should not depend on. Everything else (contexts, rules, + * robots_txt, config) is exposed verbatim so headless consumers can + * replicate the directive logic on their own front-end. * * @since 3.1.0 * @@ -1159,6 +2129,13 @@ function noindex_seo_rest_get_settings() { * both. * * @since 3.1.0 + * @since 3.5.0 WooCommerce special pages resolve their dedicated context + * first and fall back to the generic 'page' context when it + * carries no active directives — the same precedence as the + * front-end. + * @since 3.6.0 Value-carrying directives return as `name:value` tokens + * (e.g. `max-snippet:-1`), and matching conditional rules + * surface as source `auto_rule`. * * @param WP_REST_Request $request Request with `post_id` param. * @return WP_REST_Response The effective-directives payload. @@ -1179,38 +2156,52 @@ function noindex_seo_rest_get_effective( WP_REST_Request $request ) { ); } - $directives = array(); - $available = array( 'noindex', 'nofollow', 'noarchive', 'nosnippet', 'noimageindex' ); + $source = 'global_setting'; + $directive_map = array(); - // Step 1: per-post override. + // Step 1: per-post override (booleans + values from post meta). $override_raw = get_post_meta( $post_id, '_noindex_seo_override', true ); $override = ( is_scalar( $override_raw ) && 1 === absint( $override_raw ) ) ? 1 : 0; if ( $override ) { - foreach ( $available as $directive ) { - $value = get_post_meta( $post_id, '_noindex_seo_' . $directive, true ); - if ( is_scalar( $value ) && 1 === absint( $value ) ) { - $directives[] = $directive; - } + $directive_map = noindex_seo_get_post_directives_map( $post_id ); + if ( ! empty( $directive_map ) ) { + $source = 'post_meta'; } } + // Step 1.5: conditional auto-noindex rules (3.6.0) — same precedence as + // the front-end (below an explicit override, above context defaults). + if ( 'global_setting' === $source && null !== noindex_seo_matching_rule_for_post( $post_id ) ) { + $directive_map = array( 'noindex' => true ); + $source = 'auto_rule'; + } + // Step 2 + 3: fall back to per-CPT or built-in context. - if ( empty( $directives ) ) { + if ( 'global_setting' === $source ) { $post_type = $post->post_type; - if ( in_array( $post_type, array( 'post', 'page', 'attachment' ), true ) ) { - $context = $post_type; // single / page / attachment contexts are not name-aligned, but the storage context for built-in posts is 'single'. - if ( 'post' === $post_type ) { - $context = 'single'; + if ( 'page' === $post_type ) { + // WooCommerce special pages (cart, checkout, my account) have + // their own contexts; mirror the front-end precedence. + $context = noindex_seo_get_woo_context_for_page( $post->ID ); + if ( '' === $context ) { + $context = 'page'; } + } elseif ( 'post' === $post_type ) { + $context = 'single'; // The storage context for built-in posts is 'single'. + } elseif ( 'attachment' === $post_type ) { + $context = 'attachment'; } else { $context = 'cpt_' . $post_type; } - foreach ( $available as $directive ) { - if ( 1 === noindex_seo_get_setting( $context, $directive ) ) { - $directives[] = $directive; - } + $directive_map = noindex_seo_get_context_directives_map( $context ); + + // Mirror noindex_seo_show(): a WooCommerce special page whose dedicated + // context carries no active directives falls back to the generic + // 'page' context (the same iteration order the front-end uses). + if ( empty( $directive_map ) && 'page' === $post_type && 0 === strpos( $context, 'woo_' ) ) { + $directive_map = noindex_seo_get_context_directives_map( 'page' ); } } @@ -1221,9 +2212,9 @@ function noindex_seo_rest_get_effective( WP_REST_Request $request ) { array( 'post_id' => $post_id, 'post_type' => $post->post_type, - 'directives' => $directives, + 'directives' => noindex_seo_format_directives( $directive_map ), 'method' => $method, - 'source' => $override ? 'post_meta' : 'global_setting', + 'source' => $source, ), 200 ); @@ -1257,20 +2248,182 @@ function noindex_seo_invalidate_cache_on_settings_update() { add_action( 'update_option_' . NOINDEX_SEO_SETTINGS_KEY, 'noindex_seo_invalidate_cache_on_settings_update' ); add_action( 'add_option_' . NOINDEX_SEO_SETTINGS_KEY, 'noindex_seo_invalidate_cache_on_settings_update' ); +/** + * Returns the plugin's directive icons as SVG markup, keyed by directive. + * + * The icons follow the WordPress admin icon style (24x24 viewBox, 2px + * currentColor strokes): the directive's concept in the upper-left corner + * plus a "no" minus badge in the lower-right corner. + * + * Registered with the WordPress Icons API (WP 7.1+) by + * {@see noindex_seo_register_icons()}; on older versions the emoji fallback + * of {@see noindex_seo_get_directive_icon_html()} is used instead. + * + * @since 3.5.0 + * + * @return array Directive slug => SVG markup. + */ +function noindex_seo_get_directive_svg_icons() { + $badge = ''; + + $open = ''; + + return array( + 'noindex' => $open . '' . $badge . $close, + 'nofollow' => $open . '' . $badge . $close, + 'noarchive' => $open . '' . $badge . $close, + 'nosnippet' => $open . '' . $badge . $close, + 'noimageindex' => $open . '' . $badge . $close, + 'notranslate' => $open . '' . $badge . $close, + ); +} + +/** + * Registers the plugin's directive icons with the WordPress Icons API. + * + * WordPress 7.2 renders its own admin chrome through the icon registry + * ({@see wp_register_icon()} / {@see wp_get_icon()}, introduced in 7.1) — + * core replaced the admin bar and menu dashicons with SVG. Registering our + * directive icons there lets the plugin use the same crisp, color-adaptive + * rendering on WP 7.2+ while the emoji fallback keeps WordPress 7.0 and 7.1 + * fully working. + * + * The SVG path is gated to WP 7.2+ on purpose: 7.1's icon sanitizer does not + * allow `rect`/`circle` or the `stroke*` attributes (the stroke-based icons + * would be stripped to unstyled fragments), and 7.1 rejects the `public` + * collection property with a doing-it-wrong notice on every request. + * + * The collection is private (not exposed via REST or the editor icon picker): + * the icons are only consumed by this plugin's admin UI. + * + * Hooked to the {@see 'init'} action; every consumer of the icons renders + * later than init. + * + * @since 3.5.0 + * + * @return void + */ +function noindex_seo_register_icons() { + // The Icons API exists since WordPress 7.1; without it (WP 7.0) this is + // a no-op and noindex_seo_get_directive_icon_html() returns the emoji + // fallback. + if ( ! function_exists( 'wp_register_icon_collection' ) || ! function_exists( 'wp_register_icon' ) ) { + return; + } + + // WP 7.2 extended the icon sanitizer (rect/circle, stroke attributes) and + // added the 'public' collection property; '7.2-alpha1' (not '7.2') so beta + // and RC builds of 7.2 qualify for the SVG path. + if ( version_compare( (string) get_bloginfo( 'version' ), '7.2-alpha1', '<' ) ) { + return; + } + + // Guarded above: the API exists since WP 7.1 while the plugin floor is 7.0. + wp_register_icon_collection( + 'noindex-seo', + array( + 'label' => 'noindex SEO', + 'description' => 'Robots directive icons for the noindex SEO admin UI.', + 'public' => false, + ) + ); + + foreach ( noindex_seo_get_directive_svg_icons() as $directive => $svg ) { + // Guarded above: the API exists since WP 7.1 while the plugin floor is 7.0. + wp_register_icon( + 'noindex-seo/' . $directive, + array( + 'label' => 'noindex SEO: ' . $directive, + 'content' => $svg, + ) + ); + } +} +add_action( 'init', 'noindex_seo_register_icons' ); + +/** + * Returns the rendered icon markup for a robots directive. + * + * Dual-path rendering for backwards compatibility: + * + * - WordPress 7.2+: the SVG icon registered by {@see noindex_seo_register_icons()} + * through the core Icons API ({@see wp_get_icon()}) — 16px, aria-hidden, + * color-adaptive via currentColor. Rendering is consistent on every OS, + * unlike emoji. + * - WordPress 7.0 - 7.1 (and any state where the icon is not registered): + * the legacy emoji glyph, escaped and hidden from assistive technology. + * + * @since 3.5.0 + * + * @param string $directive Directive slug (noindex|nofollow|noarchive|nosnippet|noimageindex). + * @return string Safe-to-embed icon markup (SVG from the plugin's own registry, or the escaped emoji fallback). + */ +function noindex_seo_get_directive_icon_html( $directive ) { + if ( function_exists( 'wp_get_icon' ) ) { + // Guarded: the API exists since WP 7.1 while the plugin floor is 7.0. + $svg = wp_get_icon( + 'noindex-seo/' . $directive, + array( + 'size' => 16, + 'class' => 'noindex-seo-directive-icon', + ) + ); + if ( '' !== $svg ) { + return $svg; + } + } + + $emoji = array( + 'noindex' => '🔍', + 'nofollow' => '🔗', + 'noarchive' => '💾', + 'nosnippet' => '📄', + 'noimageindex' => '🖼️', + ); + + // The emoji is decorative (the directive name is always rendered next to + // it), so hide it from assistive technology like the SVG path does. + return isset( $emoji[ $directive ] ) + ? '' + : ''; +} + /** * Enqueues admin CSS and JavaScript assets. * - * Loads the modern admin panel styles and interactive JavaScript only on the - * noindex SEO settings page for better performance. + * The stylesheet loads on every admin screen where the plugin renders UI: + * the settings page, the post list (Robots column + Quick Edit + bulk + * actions), the post editor (meta box), and the term editor (per-term + * panel) — gated by the same configuration flags that gate the UI itself. + * The interactive JavaScript only loads on the settings page. * * @since 2.0.0 + * @since 3.1.6 Stylesheet also loads on list/edit/term screens so the + * meta box, Quick Edit, columns and term panel are styled + * through classes instead of inline styles (audit M7). + * Gate widened to the `edit-tags` term-list screens and the + * `attachment` Edit-Media screen (deploy-audit W1). * * @param string $hook The current admin page hook. * @return void */ function noindex_seo_enqueue_admin_assets( $hook ) { - // Only load on our settings page.. - if ( 'settings_page_noindex_seo' !== $hook ) { + $is_settings_page = ( 'settings_page_noindex_seo' === $hook ); + + $load_style = $is_settings_page; + if ( ! $load_style ) { + $screen = get_current_screen(); + if ( $screen ) { + if ( noindex_seo_get_config( 'granular', 0 ) && in_array( $screen->base, array( 'edit', 'post', 'attachment' ), true ) ) { + $load_style = true; + } elseif ( noindex_seo_get_config( 'taxonomies_granular', 0 ) && in_array( $screen->base, array( 'term', 'edit-tags' ), true ) ) { + $load_style = true; + } + } + } + + if ( ! $load_style ) { return; } @@ -1283,6 +2436,11 @@ function noindex_seo_enqueue_admin_assets( $hook ) { 'all' ); + // The interactive script is only needed on the settings page.. + if ( ! $is_settings_page ) { + return; + } + // Enqueue admin JavaScript.. wp_enqueue_script( 'noindex-seo-admin', @@ -1292,7 +2450,7 @@ function noindex_seo_enqueue_admin_assets( $hook ) { true ); - // Localize script with translations.. + // Localize script with translations and the robots.txt preset bot lists.. wp_localize_script( 'noindex-seo-admin', 'noindexSeoAdmin', @@ -1300,6 +2458,8 @@ function noindex_seo_enqueue_admin_assets( $hook ) { 'successMessage' => __( 'Settings saved successfully!', 'noindex-seo' ), 'expandAll' => __( 'Expand All', 'noindex-seo' ), 'collapseAll' => __( 'Collapse All', 'noindex-seo' ), + 'aiBots' => array_values( noindex_seo_get_ai_bots() ), + 'searchBots' => array_values( noindex_seo_get_search_bots() ), ) ); } @@ -1332,7 +2492,6 @@ function noindex_seo_enqueue_editor_assets() { } // is_block_editor() exists since WP 5.0; this callback only runs on WP 5.0+ because the hook only fires there. - /* @phpstan-ignore WPCompat.methodNotAvailable */ if ( ! $screen->is_block_editor() ) { return; } @@ -1363,7 +2522,6 @@ function noindex_seo_enqueue_editor_assets() { } } // The action only exists on WP 5.0+; on older versions it simply never fires. -/* @phpstan-ignore WPCompat.actionNotAvailable.enqueueblockeditorassets */ add_action( 'enqueue_block_editor_assets', 'noindex_seo_enqueue_editor_assets' ); /** @@ -1386,6 +2544,53 @@ function noindex_seo_settings_link( array $links ) { return $links; } +/** + * Returns the WooCommerce context slugs mapped to the wp_options that hold + * each special page's ID. + * + * WooCommerce stores the Cart, Checkout and My Account page IDs in plain + * options, so detection needs no WooCommerce code — the plugin works from + * the option values alone. Without WooCommerce the options do not exist + * and every lookup returns an empty context. + * + * @since 3.5.0 + * + * @return array context slug => option name. + */ +function noindex_seo_get_woo_context_options() { + return array( + 'woo_cart' => 'woocommerce_cart_page_id', + 'woo_checkout' => 'woocommerce_checkout_page_id', + 'woo_myaccount' => 'woocommerce_myaccount_page_id', + ); +} + +/** + * Returns the WooCommerce context matching a page ID, if any. + * + * My Account endpoints (e.g. /my-account/orders/) and the checkout + * order-pay / order-received endpoints share their parent page's ID, so + * they are covered by the same lookup. + * + * @since 3.5.0 + * + * @param int|string $page_id Page ID to look up. + * @return string Context slug ('woo_cart', 'woo_checkout', 'woo_myaccount') or ''. + */ +function noindex_seo_get_woo_context_for_page( $page_id ) { + // No static cache: get_option() is served from the options cache, and a + // cached map would go stale when the page options change mid-request + // (or between tests). + foreach ( noindex_seo_get_woo_context_options() as $context => $option_name ) { + $page_option = get_option( $option_name, 0 ); + if ( is_numeric( $page_option ) && (int) $page_option === (int) $page_id && (int) $page_id > 0 ) { + return $context; + } + } + + return ''; +} + /** * Registers the "noindex SEO" settings page in the WordPress admin menu. * @@ -1454,6 +2659,9 @@ function noindex_seo_get_contexts() { 'singular', 'tag', 'time', + 'woo_cart', + 'woo_checkout', + 'woo_myaccount', 'year', 'error', ); @@ -1527,7 +2735,7 @@ function noindex_seo_get_cpt_label( $cpt ) { function noindex_seo_register() { $contexts = noindex_seo_get_contexts(); - $directives = array( 'noindex', 'nofollow', 'noarchive', 'nosnippet', 'noimageindex' ); + $directives = noindex_seo_get_directives(); // Register each directive for each context. foreach ( $contexts as $context ) { @@ -1615,6 +2823,7 @@ function noindex_seo_detect_conflicts() { ); // Iterate through the conflicting plugins to check if any are active. + $found_conflict = false; foreach ( $conflicting_plugins as $plugin_path => $plugin_name ) { if ( is_plugin_active( $plugin_path ) ) { // Add an admin notice if a conflicting plugin is active.. @@ -1627,13 +2836,113 @@ function noindex_seo_detect_conflicts() { echo '

'; } ); + $found_conflict = true; break; // Stop checking after finding the first conflict. } } + + // Runtime verification (3.2.0): when no known plugin conflicts, check + // whether anything else is actually emitting robots directives through + // the wp_robots API — this also catches themes and unknown plugins. + // Only possible on WordPress 5.7+ (the filter does not exist earlier). + if ( ! $found_conflict && function_exists( 'has_filter' ) && has_filter( 'wp_robots' ) ) { + $foreign_callbacks = noindex_seo_get_foreign_robots_callbacks(); + if ( ! empty( $foreign_callbacks ) ) { + add_action( + 'admin_notices', + function () use ( $foreign_callbacks ) { + echo '

'; + // translators: %s: comma-separated list of wp_robots callbacks. + printf( esc_html__( 'noindex SEO has detected that another plugin or theme is adding robots directives through the wp_robots API (%s). This may cause conflicts. Please configure the options accordingly.', 'noindex-seo' ), esc_html( implode( ', ', $foreign_callbacks ) ) ); + echo '

'; + } + ); + } + } } } add_action( 'admin_init', 'noindex_seo_detect_conflicts' ); +/** + * Returns the wp_robots filter callbacks that do not belong to WordPress + * core or to this plugin. + * + * Runtime conflict verification for {@see noindex_seo_detect_conflicts()}: + * instead of trusting plugin slugs, this inspects the callbacks actually + * registered on the `wp_robots` filter. Core registers plain functions + * (wp_robots_noindex, wp_robots_noindex_embeds, wp_robots_noindex_search, + * wp_robots_max_image_preview_large and, conditionally, wp_robots_no_robots); + * anything else — named functions from other code, class methods, or + * closures — is a third-party robots emitter. + * + * Only meaningful on WordPress 5.7+; on older versions the filter does not + * exist and an empty array is returned. + * + * @since 3.2.0 + * + * @return string[] Unique readable callback identifiers ('function', + * 'Class::method' or 'Closure'). + */ +function noindex_seo_get_foreign_robots_callbacks() { + $foreign = array(); + + $wp_filter = isset( $GLOBALS['wp_filter'] ) && is_array( $GLOBALS['wp_filter'] ) ? $GLOBALS['wp_filter'] : array(); + $robots_hook = isset( $wp_filter['wp_robots'] ) ? $wp_filter['wp_robots'] : null; + if ( ! $robots_hook instanceof WP_Hook ) { + return $foreign; + } + + /** + * Filter the wp_robots callbacks considered native to WordPress core. + * + * Third-party code can extend this list if it needs to mark its own + * callback as expected (e.g. a site-specific mu-plugin). + * + * @since 3.2.0 + * + * @param string[] $core_callbacks Function names registered by core on wp_robots. + */ + $core_callbacks = apply_filters( + 'noindex_seo_core_robots_callbacks', + array( + 'wp_robots_noindex', + 'wp_robots_noindex_embeds', + 'wp_robots_noindex_search', + 'wp_robots_max_image_preview_large', + 'wp_robots_no_robots', + ) + ); + + foreach ( $robots_hook->callbacks as $callbacks ) { + foreach ( $callbacks as $callback ) { + $function = $callback['function']; + + if ( $function instanceof Closure ) { + $identifier = 'Closure'; + } elseif ( is_string( $function ) ) { + if ( in_array( $function, $core_callbacks, true ) || 0 === strpos( $function, 'noindex_seo_' ) ) { + continue; + } + $identifier = $function; + } elseif ( is_array( $function ) ) { + $class = is_object( $function[0] ) ? get_class( $function[0] ) : (string) $function[0]; + if ( 0 === strpos( $class, 'noindex_seo_' ) || 0 === strpos( $class, 'Noindex_Seo_' ) ) { + continue; + } + $identifier = $class . '::' . (string) $function[1]; + } else { + continue; + } + + if ( ! in_array( $identifier, $foreign, true ) ) { + $foreign[] = $identifier; + } + } + } + + return $foreign; +} + /** * Processes the form submission for the 'noindex SEO' plugin settings. * @@ -1641,8 +2950,10 @@ add_action( 'admin_init', 'noindex_seo_detect_conflicts' ); * It first verifies the current user's capability and nonce for security. Then it resets all * registered options to `0`, and selectively updates those submitted as checked in the form. * - * Additionally, it updates the general configuration settings, - * clears the plugin's transient cache, and redirects back to the settings page. + * The settings page is tabbed (General / SEO Settings), and only the active + * tab's fields are present in the POST body. The form carries a + * `noindex_seo_form_scope` marker so the handler knows which group to + * process and preserves the values of the other group untouched. * * Hooked to the {@see 'admin_post_update_noindex_seo'} action. * @@ -1651,87 +2962,160 @@ add_action( 'admin_init', 'noindex_seo_detect_conflicts' ); * @since 3.1.5 Nonce verification split out of the capability check: * check_admin_referer() dies on failure instead of returning * false, so `! check_admin_referer()` was dead code. + * @since 3.3.0 Tab-scoped processing: 'settings' saves only the directive + * grid, 'general' only the configuration options; the other + * group is preserved. The redirect returns to the saved tab. * * @return void */ function noindex_seo_process_form() { if ( ! current_user_can( 'manage_options' ) ) { - wp_die( esc_html__( 'Permission denied or invalid nonce.', 'noindex-seo' ) ); + wp_die( esc_html__( 'Permission denied.', 'noindex-seo' ) ); } check_admin_referer( 'update_noindex_seo_nonce' ); + // Which tab the form was submitted from. Unknown or missing scope + // defaults to the directive grid (the plugin's main surface). + // phpcs:ignore WordPress.Security.NonceVerification.Missing -- nonce verified above. + $scope = ( isset( $_POST['noindex_seo_form_scope'] ) && is_string( $_POST['noindex_seo_form_scope'] ) ) + ? sanitize_key( wp_unslash( $_POST['noindex_seo_form_scope'] ) ) + : 'settings'; + if ( ! in_array( $scope, array( 'general', 'settings', 'robotstxt' ), true ) ) { + $scope = 'settings'; + } + $contexts = noindex_seo_get_contexts(); - $directives = array( 'noindex', 'nofollow', 'noarchive', 'nosnippet', 'noimageindex' ); - - // Get the implementation method to validate field compatibility. - $method_value = ( isset( $_POST['noindex_seo_config_method'] ) && is_string( $_POST['noindex_seo_config_method'] ) ) - ? sanitize_text_field( wp_unslash( $_POST['noindex_seo_config_method'] ) ) - : 'meta'; - - // Validate method. - $method_value = in_array( $method_value, array( 'meta', 'header', 'both' ), true ) ? $method_value : 'meta'; + $directives = noindex_seo_get_directives(); // Fields that only work with HTTP headers. $header_only_contexts = array( 'attachment' ); - $is_header_enabled = in_array( $method_value, array( 'header', 'both' ), true ); // Start from the current consolidated settings so we only overwrite what // the form actually touches. The shape is preserved by noindex_seo_update_settings(). $settings = noindex_seo_get_settings(); - // Process checkbox grid: one entry per (context, directive). - foreach ( $contexts as $context ) { - foreach ( $directives as $directive ) { - $option_key = $directive . '_seo_' . $context; + if ( 'settings' === $scope ) { + // The method select lives on the General tab, so the header-only + // restriction follows the SAVED method, not the POST body. + $saved_method = noindex_seo_get_config( 'method', 'meta' ); + $is_header_enabled = in_array( $saved_method, array( 'header', 'both' ), true ); - // Header-only contexts are forced to 0 when headers aren't enabled. - if ( in_array( $context, $header_only_contexts, true ) && ! $is_header_enabled ) { - $settings['contexts'][ $context ][ $directive ] = 0; - continue; + // Process directive grid: one entry per (context, directive). + // Boolean directives arrive as '1' checkboxes; value directives as + // their raw value (empty = off). Everything normalizes through + // noindex_seo_normalize_directive_value(). + // phpcs:disable WordPress.Security.NonceVerification.Missing -- nonce verified above. + foreach ( $contexts as $context ) { + foreach ( $directives as $directive ) { + $option_key = $directive . '_seo_' . $context; + + // Header-only contexts are forced off when headers aren't enabled. + if ( in_array( $context, $header_only_contexts, true ) && ! $is_header_enabled ) { + $settings['contexts'][ $context ][ $directive ] = in_array( $directive, noindex_seo_get_value_directives(), true ) ? '' : 0; + continue; + } + + $option_value = ( isset( $_POST[ $option_key ] ) && is_string( $_POST[ $option_key ] ) ) + ? sanitize_text_field( wp_unslash( $_POST[ $option_key ] ) ) + : ''; + + $settings['contexts'][ $context ][ $directive ] = noindex_seo_normalize_directive_value( $directive, $option_value ); } + } - $option_value = ( isset( $_POST[ $option_key ] ) && is_string( $_POST[ $option_key ] ) ) - ? sanitize_text_field( wp_unslash( $_POST[ $option_key ] ) ) - : ''; + // Conditional auto-noindex rules (3.6.0): parallel arrays of fields + // and values from the rules table; each element sanitized inline. + $raw_rules = array(); + if ( isset( $_POST['noindex_seo_rule_field'], $_POST['noindex_seo_rule_value'] ) + && is_array( $_POST['noindex_seo_rule_field'] ) && is_array( $_POST['noindex_seo_rule_value'] ) ) { + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- array input; every element is sanitized in the loop below. + $fields = (array) wp_unslash( $_POST['noindex_seo_rule_field'] ); + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- array input; every element is sanitized in the loop below. + $values = (array) wp_unslash( $_POST['noindex_seo_rule_value'] ); + foreach ( $values as $index => $rule_value ) { + $field_raw = isset( $fields[ $index ] ) ? $fields[ $index ] : ''; + $raw_rules[] = array( + 'field' => is_scalar( $field_raw ) ? sanitize_text_field( wp_unslash( (string) $field_raw ) ) : '', + 'value' => is_scalar( $rule_value ) ? sanitize_text_field( wp_unslash( (string) $rule_value ) ) : '', + ); + } + } + $settings['rules'] = noindex_seo_sanitize_rules( $raw_rules ); + // phpcs:enable WordPress.Security.NonceVerification.Missing + } elseif ( 'robotstxt' === $scope ) { + // Virtual robots.txt management (3.7.0): feature toggle + bot rules + // from the parallel agent/policy arrays of the Robots.txt tab. + // phpcs:disable WordPress.Security.NonceVerification.Missing -- nonce verified above. + $settings['robots_txt']['enabled'] = isset( $_POST['noindex_seo_robotstxt_enabled'] ) ? 1 : 0; - // Only '1' counts as checked; everything else (including invalid input) is 0. - $settings['contexts'][ $context ][ $directive ] = ( '1' === $option_value ) ? 1 : 0; + $raw_rules = array(); + if ( isset( $_POST['noindex_seo_robotstxt_agent'], $_POST['noindex_seo_robotstxt_policy'] ) + && is_array( $_POST['noindex_seo_robotstxt_agent'] ) && is_array( $_POST['noindex_seo_robotstxt_policy'] ) ) { + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- array input; every element is sanitized in the loop below. + $agents = (array) wp_unslash( $_POST['noindex_seo_robotstxt_agent'] ); + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- array input; every element is sanitized in the loop below. + $policies = (array) wp_unslash( $_POST['noindex_seo_robotstxt_policy'] ); + foreach ( $policies as $index => $policy ) { + $raw_rules[] = array( + 'user_agent' => isset( $agents[ $index ] ) && is_scalar( $agents[ $index ] ) ? sanitize_text_field( wp_unslash( (string) $agents[ $index ] ) ) : '', + 'policy' => is_scalar( $policy ) ? sanitize_key( wp_unslash( (string) $policy ) ) : '', + ); + } + } + $settings['robots_txt']['rules'] = noindex_seo_sanitize_robots_txt_rules( $raw_rules ); + // phpcs:enable WordPress.Security.NonceVerification.Missing + } else { + // phpcs:disable WordPress.Security.NonceVerification.Missing -- nonce verified above. + // Get the implementation method to validate field compatibility. + $method_value = ( isset( $_POST['noindex_seo_config_method'] ) && is_string( $_POST['noindex_seo_config_method'] ) ) + ? sanitize_text_field( wp_unslash( $_POST['noindex_seo_config_method'] ) ) + : 'meta'; + + // Validate method. + $settings['config']['method'] = in_array( $method_value, array( 'meta', 'header', 'both' ), true ) ? $method_value : 'meta'; + + // Save general configuration values. + $config_value = ( isset( $_POST['noindex_seo_config_seoplugins'] ) && is_string( $_POST['noindex_seo_config_seoplugins'] ) ) + ? absint( $_POST['noindex_seo_config_seoplugins'] ) + : 0; + $settings['config']['seoplugins'] = ( 1 === $config_value ) ? 1 : 0; + + // Granular control. + $granular_value = ( isset( $_POST['noindex_seo_config_granular'] ) && is_string( $_POST['noindex_seo_config_granular'] ) ) + ? absint( $_POST['noindex_seo_config_granular'] ) + : 0; + $settings['config']['granular'] = ( 1 === $granular_value ) ? 1 : 0; + + // Per-term granular control on taxonomies. + $tax_granular_value = ( isset( $_POST['noindex_seo_config_taxonomies_granular'] ) && is_string( $_POST['noindex_seo_config_taxonomies_granular'] ) ) + ? absint( $_POST['noindex_seo_config_taxonomies_granular'] ) + : 0; + $settings['config']['taxonomies_granular'] = ( 1 === $tax_granular_value ) ? 1 : 0; + + // Delete-on-uninstall opt-in. + $delete_value = ( isset( $_POST['noindex_seo_config_delete_on_uninstall'] ) && is_string( $_POST['noindex_seo_config_delete_on_uninstall'] ) ) + ? absint( $_POST['noindex_seo_config_delete_on_uninstall'] ) + : 0; + $settings['config']['delete_on_uninstall'] = ( 1 === $delete_value ) ? 1 : 0; + // phpcs:enable WordPress.Security.NonceVerification.Missing + + // Keep the header-only invariant consistent with the (possibly just + // changed) method: attachment directives cannot survive a method + // that does not send HTTP headers. + $is_header_enabled = in_array( $settings['config']['method'], array( 'header', 'both' ), true ); + if ( ! $is_header_enabled ) { + foreach ( $directives as $directive ) { + $settings['contexts']['attachment'][ $directive ] = in_array( $directive, noindex_seo_get_value_directives(), true ) ? '' : 0; + } } } - // Save general configuration values. - $config_value = ( isset( $_POST['noindex_seo_config_seoplugins'] ) && is_string( $_POST['noindex_seo_config_seoplugins'] ) ) - ? absint( $_POST['noindex_seo_config_seoplugins'] ) - : 0; - $settings['config']['seoplugins'] = ( 1 === $config_value ) ? 1 : 0; - - // Implementation method (validated above). - $settings['config']['method'] = $method_value; - - // Granular control. - $granular_value = ( isset( $_POST['noindex_seo_config_granular'] ) && is_string( $_POST['noindex_seo_config_granular'] ) ) - ? absint( $_POST['noindex_seo_config_granular'] ) - : 0; - $settings['config']['granular'] = ( 1 === $granular_value ) ? 1 : 0; - - // Per-term granular control on taxonomies. - $tax_granular_value = ( isset( $_POST['noindex_seo_config_taxonomies_granular'] ) && is_string( $_POST['noindex_seo_config_taxonomies_granular'] ) ) - ? absint( $_POST['noindex_seo_config_taxonomies_granular'] ) - : 0; - $settings['config']['taxonomies_granular'] = ( 1 === $tax_granular_value ) ? 1 : 0; - - // Delete-on-uninstall opt-in. - $delete_value = ( isset( $_POST['noindex_seo_config_delete_on_uninstall'] ) && is_string( $_POST['noindex_seo_config_delete_on_uninstall'] ) ) - ? absint( $_POST['noindex_seo_config_delete_on_uninstall'] ) - : 0; - $settings['config']['delete_on_uninstall'] = ( 1 === $delete_value ) ? 1 : 0; - // Persist. This fires update_option_noindex_seo_settings, which clears the // transient via noindex_seo_invalidate_cache_on_settings_update() — so we // no longer need to delete_transient() by hand here. noindex_seo_update_settings( $settings ); - wp_safe_redirect( admin_url( 'options-general.php?page=noindex_seo&updated=true' ) ); + wp_safe_redirect( admin_url( 'options-general.php?page=noindex_seo&tab=' . $scope . '&updated=true' ) ); exit; } add_action( 'admin_post_update_noindex_seo', 'noindex_seo_process_form' ); @@ -1739,29 +3123,33 @@ add_action( 'admin_post_update_noindex_seo', 'noindex_seo_process_form' ); /** * Handles the "Apply recommended defaults" form action. * - * Iterates the settings page section definitions and enables every directive - * for every context flagged `'suggestion' => true`. The 12 contexts currently - * flagged are: privacy_policy, date, day, month, time, year, paged, search, - * attachment, customize_preview, preview, error. + * Iterates the settings page section definitions and enables every boolean + * directive for every context flagged `'suggestion' => true`. The 15 contexts + * currently flagged are: privacy_policy, date, day, month, time, year, paged, + * search, attachment, customize_preview, preview, error, woo_cart, + * woo_checkout, woo_myaccount. * - * All five directives are enabled on each suggested context. This is the same - * shape a manual click-through would produce, so the form is fully editable - * afterwards. + * All six boolean directives (noindex, nofollow, noarchive, nosnippet, + * noimageindex, notranslate) are enabled on each suggested context — + * value-carrying directives (3.6.0) are untouched because "enabling" them + * without a value is meaningless. This is the same shape a manual + * click-through would produce, so the form is fully editable afterwards. * * Hooked to the {@see 'admin_post_noindex_seo_apply_suggestions'} action. * * @since 3.0.0 * @since 3.1.5 Same nonce-verification split as noindex_seo_process_form(). + * @since 3.3.0 Redirects back to the SEO Settings tab. * * @return void */ function noindex_seo_process_apply_suggestions() { if ( ! current_user_can( 'manage_options' ) ) { - wp_die( esc_html__( 'Permission denied or invalid nonce.', 'noindex-seo' ) ); + wp_die( esc_html__( 'Permission denied.', 'noindex-seo' ) ); } check_admin_referer( 'noindex_seo_apply_suggestions_nonce' ); - $directives = array( 'noindex', 'nofollow', 'noarchive', 'nosnippet', 'noimageindex' ); + $directives = noindex_seo_get_boolean_directives(); $settings = noindex_seo_get_settings(); foreach ( noindex_seo_get_suggested_contexts() as $context ) { @@ -1772,11 +3160,725 @@ function noindex_seo_process_apply_suggestions() { noindex_seo_update_settings( $settings ); - wp_safe_redirect( admin_url( 'options-general.php?page=noindex_seo&suggestions_applied=1' ) ); + wp_safe_redirect( admin_url( 'options-general.php?page=noindex_seo&tab=settings&suggestions_applied=1' ) ); exit; } add_action( 'admin_post_noindex_seo_apply_suggestions', 'noindex_seo_process_apply_suggestions' ); +/** + * Builds the JSON export payload for the current settings. + * + * The payload carries a plugin marker, an export timestamp and the full + * consolidated settings array, so a backup can be identified and validated + * on import. + * + * @since 3.2.0 + * + * @return array Export payload. + */ +function noindex_seo_build_export_payload() { + return array( + 'plugin' => 'noindex-seo', + 'exported' => gmdate( 'c' ), + 'settings' => noindex_seo_get_settings(), + ); +} + +/** + * Handles the "Export settings" form action: streams the current settings + * as a downloadable JSON file. + * + * Hooked to the {@see 'admin_post_noindex_seo_export'} action. + * + * @since 3.2.0 + * + * @return void + */ +function noindex_seo_handle_export() { + if ( ! current_user_can( 'manage_options' ) ) { + wp_die( esc_html__( 'Permission denied.', 'noindex-seo' ) ); + } + check_admin_referer( 'noindex_seo_export' ); + + nocache_headers(); + header( 'Content-Type: application/json; charset=utf-8' ); + header( 'Content-Disposition: attachment; filename=noindex-seo-settings-' . gmdate( 'Ymd-His' ) . '.json' ); + echo wp_json_encode( noindex_seo_build_export_payload() ); + exit; +} +add_action( 'admin_post_noindex_seo_export', 'noindex_seo_handle_export' ); + +/** + * Validates and sanitizes a settings array that came from an imported + * JSON file. + * + * Only contexts and directives currently known to the plugin are imported + * (contexts for custom post types that do not exist on this site are + * silently dropped); every directive value is normalized to 0/1 and every + * config value to its safelisted form. The returned array always has the + * full default shape of noindex_seo_get_settings(). + * + * @since 3.2.0 + * @since 3.6.0 Value directives normalize through + * noindex_seo_normalize_directive_value() and the conditional + * rules are sanitized with noindex_seo_sanitize_rules(). + * + * @param mixed $raw Decoded JSON 'settings' value. + * @return array{ + * version: int, + * contexts: array>, + * rules: array, + * config: array{ + * method: string, + * granular: int, + * taxonomies_granular: int, + * seoplugins: int, + * delete_on_uninstall: int + * } + * }|null Sanitized settings array, or null when the payload is not importable. + */ +function noindex_seo_sanitize_imported_settings( $raw ) { + if ( ! is_array( $raw ) || ! isset( $raw['contexts'], $raw['config'] ) || ! is_array( $raw['contexts'] ) || ! is_array( $raw['config'] ) ) { + return null; + } + + $settings = noindex_seo_get_settings(); + $directives = noindex_seo_get_directives(); + + foreach ( noindex_seo_get_contexts() as $context ) { + if ( ! isset( $raw['contexts'][ $context ] ) || ! is_array( $raw['contexts'][ $context ] ) ) { + continue; + } + foreach ( $directives as $directive ) { + if ( array_key_exists( $directive, $raw['contexts'][ $context ] ) && is_scalar( $raw['contexts'][ $context ][ $directive ] ) ) { + $settings['contexts'][ $context ][ $directive ] = noindex_seo_normalize_directive_value( $directive, $raw['contexts'][ $context ][ $directive ] ); + } + } + } + + if ( array_key_exists( 'rules', $raw ) ) { + $settings['rules'] = noindex_seo_sanitize_rules( $raw['rules'] ); + } + + // Virtual robots.txt rules (3.7.0) ride the JSON backup as well. + if ( isset( $raw['robots_txt'] ) && is_array( $raw['robots_txt'] ) ) { + $settings['robots_txt']['enabled'] = empty( $raw['robots_txt']['enabled'] ) ? 0 : 1; + if ( isset( $raw['robots_txt']['rules'] ) ) { + $settings['robots_txt']['rules'] = noindex_seo_sanitize_robots_txt_rules( $raw['robots_txt']['rules'] ); + } + } + + $raw_config = $raw['config']; + + $method = isset( $raw_config['method'] ) && is_string( $raw_config['method'] ) + ? $raw_config['method'] + : 'meta'; + $settings['config']['method'] = in_array( $method, array( 'meta', 'header', 'both' ), true ) ? $method : 'meta'; + + foreach ( array( 'granular', 'taxonomies_granular', 'seoplugins', 'delete_on_uninstall' ) as $key ) { + $value = isset( $raw_config[ $key ] ) && is_numeric( $raw_config[ $key ] ) ? (int) $raw_config[ $key ] : 0; + $settings['config'][ $key ] = ( 1 === $value ) ? 1 : 0; + } + + return $settings; +} + +/** + * Handles the "Import settings" form action: reads an uploaded JSON backup + * and restores the global settings from it. + * + * The upload is validated (error code, size limit, is_uploaded_file) and + * never persisted to the uploads directory. Per-post and per-term granular + * overrides are content data and are never touched by an import. + * + * Hooked to the {@see 'admin_post_noindex_seo_import'} action. + * + * @since 3.2.0 + * @since 3.3.0 Redirects back to the Import / Export tab. + * + * @return void + */ +function noindex_seo_handle_import() { + if ( ! current_user_can( 'manage_options' ) ) { + wp_die( esc_html__( 'Permission denied.', 'noindex-seo' ) ); + } + check_admin_referer( 'noindex_seo_import' ); + + $redirect_error = admin_url( 'options-general.php?page=noindex_seo&tab=tools&import_error=1' ); + + // The upload is validated immediately below (error code, size, is_uploaded_file) and its + // contents go through strict JSON shape validation before anything is persisted. + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized + $upload = isset( $_FILES['noindex_seo_import_file'] ) && is_array( $_FILES['noindex_seo_import_file'] ) + ? $_FILES['noindex_seo_import_file'] // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized + : array(); + + $error = isset( $upload['error'] ) && is_numeric( $upload['error'] ) ? (int) $upload['error'] : -1; + $size = isset( $upload['size'] ) && is_numeric( $upload['size'] ) ? (int) $upload['size'] : 0; + $tmp = isset( $upload['tmp_name'] ) && is_string( $upload['tmp_name'] ) ? $upload['tmp_name'] : ''; + + if ( UPLOAD_ERR_OK !== $error || '' === $tmp || $size > 1048576 || ! is_uploaded_file( $tmp ) ) { + wp_safe_redirect( $redirect_error ); + exit; + } + + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- reading the just-validated upload before it is discarded; is_uploaded_file() was checked above. + $raw = file_get_contents( $tmp ); + $data = is_string( $raw ) ? json_decode( $raw, true ) : null; + + if ( ! is_array( $data ) || 'noindex-seo' !== ( isset( $data['plugin'] ) ? $data['plugin'] : '' ) ) { + wp_safe_redirect( $redirect_error ); + exit; + } + + $settings = noindex_seo_sanitize_imported_settings( isset( $data['settings'] ) ? $data['settings'] : null ); + + if ( null === $settings ) { + wp_safe_redirect( $redirect_error ); + exit; + } + + noindex_seo_update_settings( $settings ); + + wp_safe_redirect( admin_url( 'options-general.php?page=noindex_seo&tab=tools&imported=1' ) ); + exit; +} +add_action( 'admin_post_noindex_seo_import', 'noindex_seo_handle_import' ); + +/** + * Handles the "Import from other plugins" action (3.7.0, spec section 5). + * + * On-demand and confirmed by the user: only the sources checked in the form + * are imported, and noindex SEO never overwrites content that already + * carries its own override data (skipped and counted instead). Redirects + * back to the tools tab with the totals for the result notices. + * + * Hooked to the {@see 'admin_post_noindex_seo_plugin_import'} action. + * + * @since 3.7.0 + * + * @return void + */ +function noindex_seo_handle_plugin_import() { + if ( ! current_user_can( 'manage_options' ) ) { + wp_die( esc_html__( 'Permission denied.', 'noindex-seo' ) ); + } + check_admin_referer( 'noindex_seo_plugin_import' ); + + $known = array_keys( noindex_seo_get_import_sources() ); + $slugs = array(); + $raw_selection = isset( $_POST['noindex_seo_import_sources'] ) && is_array( $_POST['noindex_seo_import_sources'] ) + ? wp_unslash( $_POST['noindex_seo_import_sources'] ) // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- array of slugs, whitelisted against the known sources below. + : array(); + foreach ( $raw_selection as $slug ) { + if ( is_string( $slug ) && in_array( sanitize_key( $slug ), $known, true ) ) { + $slugs[] = sanitize_key( $slug ); + } + } + + $redirect = admin_url( 'options-general.php?page=noindex_seo&tab=tools' ); + + if ( array() === $slugs ) { + wp_safe_redirect( add_query_arg( 'plugin_import_empty', '1', $redirect ) ); + exit; + } + + $totals = noindex_seo_run_import( $slugs ); + + wp_safe_redirect( + add_query_arg( + array( + 'plugin_import_posts' => $totals['posts'], + 'plugin_import_terms' => $totals['terms'], + 'plugin_import_skipped_posts' => $totals['skipped_posts'], + 'plugin_import_skipped_terms' => $totals['skipped_terms'], + ), + ( $totals['posts'] || $totals['terms'] || $totals['skipped_posts'] || $totals['skipped_terms'] ) + ? $redirect + : add_query_arg( 'plugin_import_done', '1', $redirect ) + ) + ); + exit; +} +add_action( 'admin_post_noindex_seo_plugin_import', 'noindex_seo_handle_plugin_import' ); + +/** + * Applies a directive change to a context in the consolidated settings. + * + * Shared logic of the `wp noindex-seo set|unset` commands: validates the + * context and the directives, enforces the header-only invariant for the + * attachment context, persists via noindex_seo_update_settings() (which + * also invalidates the transient cache) and reports what changed. + * + * Directive tokens are plain names for boolean directives (noindex, notranslate, + * …) and `name=value` pairs for value directives (max-snippet=-1, + * max-image-preview=large, unavailable_after=2030-01-01 09:00). Passing a + * value for a boolean directive, or an invalid or missing value for a value + * directive, is rejected with a descriptive error. + * + * @since 3.4.0 + * @since 3.6.0 Value directives are supported via name=value tokens. + * + * @param string $context Context slug. + * @param string[] $directives Directive tokens (names or name=value). + * @param bool $enable True to enable, false to disable. + * @return true|WP_Error True on success, WP_Error describing the first problem found. + */ +function noindex_seo_cli_apply_directives( $context, array $directives, $enable ) { + if ( ! in_array( $context, noindex_seo_get_contexts(), true ) ) { + return new WP_Error( 'noindex_seo_cli_unknown_context', sprintf( "Unknown context '%s'. Run 'wp noindex-seo list' to see the available contexts.", $context ) ); + } + + $valid_directives = noindex_seo_get_directives(); + $parsed = array(); + foreach ( $directives as $token ) { + $name = $token; + $value = null; + if ( false !== strpos( $token, '=' ) ) { + $pieces = explode( '=', $token, 2 ); + $name = $pieces[0]; + $value = $pieces[1]; + } + + if ( ! in_array( $name, $valid_directives, true ) ) { + return new WP_Error( 'noindex_seo_cli_unknown_directive', sprintf( "Unknown directive '%s'. Valid directives: %s.", $name, implode( ', ', $valid_directives ) ) ); + } + + if ( in_array( $name, noindex_seo_get_boolean_directives(), true ) ) { + if ( null !== $value ) { + return new WP_Error( 'noindex_seo_cli_unexpected_value', sprintf( "Directive '%s' does not take a value; pass just the name.", $name ) ); + } + $parsed[ $name ] = $enable ? 1 : 0; + continue; + } + + // Value directive: enabling requires a valid value; disabling clears it. + if ( ! $enable ) { + $parsed[ $name ] = ''; + continue; + } + $normalized = noindex_seo_normalize_directive_value( $name, $value ); + if ( null === $value || '' === $normalized ) { + return new WP_Error( + 'noindex_seo_cli_invalid_value', + sprintf( + "Invalid or missing value for '%s'. Use %s. Example: %s.", + $name, + 'max-snippet|max-video-preview' === $name ? 'an integer >= -1' : ( 'max-image-preview' === $name ? 'none, standard or large' : 'a date and time like 2030-01-01 09:00' ), + 'max-snippet|max-video-preview' === $name ? 'max-snippet=-1' : ( 'max-image-preview' === $name ? 'max-image-preview=large' : 'unavailable_after=2030-01-01 09:00' ) + ) + ); + } + $parsed[ $name ] = $normalized; + } + + // The attachment context only works with HTTP headers (same rule as the + // settings page), so refuse enabling it under a meta-only method. + $method = noindex_seo_get_config( 'method', 'meta' ); + $method = is_string( $method ) ? $method : 'meta'; + if ( $enable && 'attachment' === $context && ! in_array( $method, array( 'header', 'both' ), true ) ) { + return new WP_Error( + 'noindex_seo_cli_header_only', + sprintf( + "The attachment context only works with HTTP headers; the current implementation method is '%s'. Switch the method first: wp option update noindex_seo_settings ... or use the settings page.", + $method + ) + ); + } + + $settings = noindex_seo_get_settings(); + foreach ( $parsed as $directive => $value ) { + $settings['contexts'][ $context ][ $directive ] = $value; + } + + noindex_seo_update_settings( $settings ); + + return true; +} + +/** + * Builds the rows for the `wp noindex-seo list` command. + * + * Boolean directives report on/off; value directives (3.6.0) report their + * value (e.g. `max-snippet:-1`) or off. + * + * @since 3.4.0 + * @since 3.6.0 Value directives report their configured value. + * + * @param string $context_filter Optional context slug to filter by. Empty for all. + * @return array Rows. + */ +function noindex_seo_cli_get_rows( $context_filter = '' ) { + $rows = array(); + + foreach ( noindex_seo_get_contexts() as $context ) { + if ( '' !== $context_filter && $context !== $context_filter ) { + continue; + } + foreach ( noindex_seo_get_directives() as $directive ) { + $value = noindex_seo_get_setting( $context, $directive ); + + if ( in_array( $directive, noindex_seo_get_boolean_directives(), true ) ) { + $status = $value ? 'on' : 'off'; + } elseif ( '' === $value ) { + $status = 'off'; + } else { + $status = noindex_seo_format_value_directive( $directive, (string) $value ); + } + + $rows[] = array( + 'context' => $context, + 'directive' => $directive, + 'status' => $status, + ); + } + } + + return $rows; +} + +/** + * WP-CLI command: lists every context x directive pair and its status. + * + * ## OPTIONS + * + * [--only=] + * : Only list the given context slug. + * + * [--format=] + * : Render output in a particular format. + * --- + * default: table + * options: + * - table + * - csv + * - json + * - yaml + * --- + * + * ## EXAMPLES + * + * wp noindex-seo list + * wp noindex-seo list --only=search --format=json + * + * @since 3.4.0 + * @since 3.5.0 The filter parameter is `--only`: WP-CLI 2.11+ reserves the + * global `--context` flag for its own context switching, so a + * command parameter of that name never reaches the handler. + * Output now goes through the namespaced format_items() + * function — the real WP-CLI API (the static WP_CLI\Utils:: + * format_items() call fatalled on every invocation). + * + * @param array $args Positional arguments (unused). + * @param array $assoc_args Associative arguments. + * @return void + */ +function noindex_seo_cli_list( $args, $assoc_args ) { + $context_filter = ''; + if ( isset( $assoc_args['only'] ) && is_string( $assoc_args['only'] ) && '' !== $assoc_args['only'] ) { + // Validate the raw value against the known contexts: sanitize_key() + // alone would silently turn an invalid value into '' and list everything. + if ( ! in_array( $assoc_args['only'], noindex_seo_get_contexts(), true ) ) { + WP_CLI::error( sprintf( "Unknown context '%s'. Run 'wp noindex-seo list' to see the available contexts.", $assoc_args['only'] ) ); + return; + } + $context_filter = $assoc_args['only']; + } + + $rows = noindex_seo_cli_get_rows( $context_filter ); + + $format = isset( $assoc_args['format'] ) && is_string( $assoc_args['format'] ) ? $assoc_args['format'] : 'table'; + WP_CLI\Utils\format_items( $format, $rows, array( 'context', 'directive', 'status' ) ); +} + +/** + * WP-CLI command: enables directives on a context. + * + * ## OPTIONS + * + * + * : Context slug (see `wp noindex-seo list`). + * + * [...] + * : One or more directives to enable. Boolean directives by name + * (noindex, nofollow, noarchive, nosnippet, noimageindex, notranslate); + * value directives as name=value (e.g. max-snippet=-1, + * max-image-preview=large, unavailable_after="2030-01-01 09:00" — + * datetimes need quoting because of the space, or a T separator: + * unavailable_after=2030-01-01T09:00). Default: all six boolean directives. + * + * ## EXAMPLES + * + * wp noindex-seo set search noindex + * wp noindex-seo set date noindex noarchive + * wp noindex-seo set archive max-snippet=-1 max-image-preview=large + * + * @since 3.4.0 + * @since 3.6.0 Value directives accepted as name=value tokens; notranslate + * joined the boolean set. + * + * @param array $args [context, directive...]. + * @param array $assoc_args Associative arguments (unused). + * @return void + */ +function noindex_seo_cli_set( $args, $assoc_args ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed -- required by the WP-CLI callback signature + if ( empty( $args ) ) { + WP_CLI::error( 'Usage: wp noindex-seo set [...]' ); + return; + } + + $context = sanitize_key( (string) array_shift( $args ) ); + $directives = noindex_seo_get_boolean_directives(); + if ( ! empty( $args ) ) { + // Not sanitize_key(): value tokens contain '=', and datetime values + // contain ':' and '-'; noindex_seo_cli_apply_directives() validates. + $directives = array_values( array_filter( array_map( 'trim', array_map( 'sanitize_text_field', $args ) ) ) ); + } + + $result = noindex_seo_cli_apply_directives( $context, $directives, true ); + if ( is_wp_error( $result ) ) { + WP_CLI::error( $result->get_error_message() ); + return; + } + + WP_CLI::success( sprintf( "Enabled %s on '%s'.", implode( ', ', $directives ), $context ) ); +} + +/** + * WP-CLI command: disables directives on a context. + * + * ## OPTIONS + * + * + * : Context slug (see `wp noindex-seo list`). + * + * [...] + * : One or more directives to disable. Boolean directives by name; value + * directives by plain name (max-snippet) — passing a value is not needed + * to disable. Default: all six boolean directives. + * + * ## EXAMPLES + * + * wp noindex-seo unset search noindex + * wp noindex-seo unset archive max-snippet + * + * @since 3.4.0 + * @since 3.6.0 Value directives can be disabled by plain name. + * + * @param array $args [context, directive...]. + * @param array $assoc_args Associative arguments (unused). + * @return void + */ +function noindex_seo_cli_unset( $args, $assoc_args ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed -- required by the WP-CLI callback signature + if ( empty( $args ) ) { + WP_CLI::error( 'Usage: wp noindex-seo unset [...]' ); + return; + } + + $context = sanitize_key( (string) array_shift( $args ) ); + $directives = noindex_seo_get_boolean_directives(); + if ( ! empty( $args ) ) { + $directives = array_values( array_filter( array_map( 'trim', array_map( 'sanitize_text_field', $args ) ) ) ); + } + + $result = noindex_seo_cli_apply_directives( $context, $directives, false ); + if ( is_wp_error( $result ) ) { + WP_CLI::error( $result->get_error_message() ); + return; + } + + WP_CLI::success( sprintf( "Disabled %s on '%s'.", implode( ', ', $directives ), $context ) ); +} + +/** + * WP-CLI command: exports the settings as JSON. + * + * Writes the same payload as the "Export settings" button. + * + * ## OPTIONS + * + * [] + * : Path of the JSON file to write. Default: print to STDOUT. + * + * ## EXAMPLES + * + * wp noindex-seo export > noindex-seo-backup.json + * wp noindex-seo export backup.json + * + * @since 3.4.0 + * + * @param array $args []. + * @param array $assoc_args Associative arguments (unused). + * @return void + */ +function noindex_seo_cli_export( $args, $assoc_args ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed -- required by the WP-CLI callback signature + $json = wp_json_encode( noindex_seo_build_export_payload() ); + if ( false === $json ) { + WP_CLI::error( 'Could not encode the settings as JSON.' ); + return; + } + + if ( empty( $args ) ) { + WP_CLI::line( $json ); + return; + } + + $file = (string) $args[0]; + $written = file_put_contents( $file, $json . "\n" ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents -- CLI context, the path is operator-supplied. + if ( false === $written ) { + WP_CLI::error( sprintf( "Could not write to '%s'.", $file ) ); + } + + WP_CLI::success( sprintf( "Exported settings to '%s'.", $file ) ); +} + +/** + * WP-CLI command: imports settings from a previously exported JSON file. + * + * Applies the same validation and sanitization as the "Import settings" + * form; per-post and per-term overrides are never touched. + * + * ## OPTIONS + * + * + * : Path of a JSON file produced by `wp noindex-seo export` or the tools tab. + * + * [--dry-run] + * : Validate and report the number of values that would change, without saving. + * + * ## EXAMPLES + * + * wp noindex-seo import noindex-seo-backup.json --dry-run + * wp noindex-seo import noindex-seo-backup.json + * + * @since 3.4.0 + * + * @param array $args []. + * @param array $assoc_args Associative arguments. + * @return void + */ +function noindex_seo_cli_import( $args, $assoc_args ) { + if ( empty( $args ) ) { + WP_CLI::error( 'Usage: wp noindex-seo import [--dry-run]' ); + return; + } + + $file = (string) $args[0]; + if ( ! is_readable( $file ) ) { + WP_CLI::error( sprintf( "Cannot read '%s'.", $file ) ); + return; + } + + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- CLI context, local operator-supplied file, existence checked above. + $raw = file_get_contents( $file ); + $data = is_string( $raw ) ? json_decode( $raw, true ) : null; + + if ( ! is_array( $data ) ) { + WP_CLI::error( sprintf( "'%s' is not a valid noindex SEO export.", $file ) ); + return; + } + + $marker = isset( $data['plugin'] ) && is_string( $data['plugin'] ) ? $data['plugin'] : ''; + if ( 'noindex-seo' !== $marker ) { + WP_CLI::error( sprintf( "'%s' is not a valid noindex SEO export.", $file ) ); + return; + } + + $settings = noindex_seo_sanitize_imported_settings( isset( $data['settings'] ) ? $data['settings'] : null ); + if ( null === $settings ) { + WP_CLI::error( sprintf( "'%s' does not contain valid settings.", $file ) ); + return; + } + + if ( isset( $assoc_args['dry-run'] ) ) { + $current = noindex_seo_get_settings(); + $changes = 0; + foreach ( $settings['contexts'] as $context => $directives ) { + foreach ( $directives as $directive => $value ) { + if ( $current['contexts'][ $context ][ $directive ] !== $value ) { + ++$changes; + } + } + } + foreach ( $settings['config'] as $key => $value ) { + if ( $current['config'][ $key ] !== $value ) { + ++$changes; + } + } + WP_CLI::line( sprintf( 'Dry run: %d setting(s) would change. Re-run without --dry-run to apply.', $changes ) ); + return; + } + + noindex_seo_update_settings( $settings ); + WP_CLI::success( 'Settings imported.' ); +} + +/** + * WP-CLI command: bulk per-post granular overrides. + * + * Scales beyond the ~200-post ceiling of the bulk UI: enables or disables + * the robots override for the given post IDs, mirroring the "Enable / + * Disable Robots Override" bulk actions. + * + * ## OPTIONS + * + * ... + * : One or more post IDs. + * + * [--off] + * : Disable the override (default: enable). Disabling also clears the + * directive meta so the posts fall back to the global settings. + * + * ## EXAMPLES + * + * wp noindex-seo override 123 456 + * wp noindex-seo override $(wp post list --post_type=page --field=ID) --off + * + * @since 3.4.0 + * + * @param array $args Post IDs. + * @param array $assoc_args Associative arguments. + * @return void + */ +function noindex_seo_cli_override( $args, $assoc_args ) { + if ( empty( $args ) ) { + WP_CLI::error( 'Usage: wp noindex-seo override ... [--off]' ); + return; + } + + $disable = isset( $assoc_args['off'] ); + $done = 0; + + foreach ( $args as $raw_id ) { + $post_id = (int) $raw_id; + $post = get_post( $post_id ); + if ( ! $post ) { + WP_CLI::warning( sprintf( 'Skipping %d: post does not exist.', $post_id ) ); + continue; + } + + if ( $disable ) { + delete_post_meta( $post_id, '_noindex_seo_override' ); + noindex_seo_clear_post_directives( $post_id ); + } else { + update_post_meta( $post_id, '_noindex_seo_override', 1 ); + } + ++$done; + } + + WP_CLI::success( sprintf( '%s override for %d post(s).', $disable ? 'Disabled' : 'Enabled', $done ) ); +} + +// Register the WP-CLI commands only when running under WP-CLI. +if ( defined( 'WP_CLI' ) && WP_CLI && class_exists( 'WP_CLI' ) ) { + WP_CLI::add_command( 'noindex-seo list', 'noindex_seo_cli_list' ); + WP_CLI::add_command( 'noindex-seo set', 'noindex_seo_cli_set' ); + WP_CLI::add_command( 'noindex-seo unset', 'noindex_seo_cli_unset' ); + WP_CLI::add_command( 'noindex-seo export', 'noindex_seo_cli_export' ); + WP_CLI::add_command( 'noindex-seo import', 'noindex_seo_cli_import' ); + WP_CLI::add_command( 'noindex-seo override', 'noindex_seo_cli_override' ); +} + /** * Returns the list of contexts flagged as suggested defaults on the settings page. * @@ -1784,6 +3886,8 @@ add_action( 'admin_post_noindex_seo_apply_suggestions', 'noindex_seo_process_app * WP-CLI command share the same definition of "recommended". * * @since 3.0.0 + * @since 3.5.0 Added the WooCommerce contexts (woo_cart, woo_checkout, + * woo_myaccount); the suggested set grew from 12 to 15 contexts. * * @return string[] List of context slugs. */ @@ -1814,6 +3918,9 @@ function noindex_seo_get_suggested_contexts() { 'customize_preview', 'preview', 'error', + 'woo_cart', + 'woo_checkout', + 'woo_myaccount', ) ); } @@ -1828,6 +3935,10 @@ function noindex_seo_get_suggested_contexts() { * @since 3.1.3 Skipped on WordPress versions without register_post_meta() * (pre-4.9.6): granular control still works there through the * classic meta box, Quick Edit and bulk actions. + * @since 3.7.1 Adds 'custom-fields' post type support for the registered + * types: without it the REST API exposes no `meta` field and + * the block editor sidebar silently drops every save on + * custom post types registered without that support. * * @return void */ @@ -1845,19 +3956,38 @@ function noindex_seo_register_post_meta() { // Get all public post types. $post_types = get_post_types( array( 'public' => true ), 'names' ); - // Meta fields to register. - $meta_fields = array( + // The REST API (and with it the block editor sidebar) only exposes the + // `meta` field for post types that support 'custom-fields'. Custom post + // types registered without it (a very common registration) would + // silently drop every sidebar save with an HTTP 200, so the support is + // added for exactly the post types the plugin registers meta on. + foreach ( $post_types as $post_type ) { + if ( ! post_type_supports( $post_type, 'custom-fields' ) ) { + add_post_type_support( $post_type, 'custom-fields' ); + } + } + + // Meta fields to register. Boolean directives (and the override flag) are + // integers; value directives (3.6.0) are strings normalized on write. + $boolean_meta_fields = array( '_noindex_seo_override', '_noindex_seo_noindex', '_noindex_seo_nofollow', '_noindex_seo_noarchive', '_noindex_seo_nosnippet', '_noindex_seo_noimageindex', + '_noindex_seo_notranslate', + ); + $value_meta_fields = array( + '_noindex_seo_max-snippet', + '_noindex_seo_max-image-preview', + '_noindex_seo_max-video-preview', + '_noindex_seo_unavailable_after', ); // Register each meta field for each post type. foreach ( $post_types as $post_type ) { - foreach ( $meta_fields as $meta_key ) { + foreach ( $boolean_meta_fields as $meta_key ) { register_post_meta( $post_type, $meta_key, @@ -1872,6 +4002,24 @@ function noindex_seo_register_post_meta() { ) ); } + foreach ( $value_meta_fields as $meta_key ) { + register_post_meta( + $post_type, + $meta_key, + array( + 'show_in_rest' => true, + 'single' => true, + 'type' => 'string', + 'default' => '', + 'sanitize_callback' => function ( $raw ) use ( $meta_key ) { + return noindex_seo_normalize_directive_value( str_replace( '_noindex_seo_', '', $meta_key ), $raw ); + }, + 'auth_callback' => function () { + return current_user_can( 'edit_posts' ); + }, + ) + ); + } } } add_action( 'init', 'noindex_seo_register_post_meta' ); @@ -1942,113 +4090,141 @@ function noindex_seo_render_meta_box( WP_Post $post ) { wp_nonce_field( 'noindex_seo_meta_box', 'noindex_seo_meta_box_nonce' ); // Get current post meta values. - $override = get_post_meta( $post->ID, '_noindex_seo_override', true ); - $noindex = get_post_meta( $post->ID, '_noindex_seo_noindex', true ); - $nofollow = get_post_meta( $post->ID, '_noindex_seo_nofollow', true ); - $noarchive = get_post_meta( $post->ID, '_noindex_seo_noarchive', true ); - $nosnippet = get_post_meta( $post->ID, '_noindex_seo_nosnippet', true ); - $noimageindex = get_post_meta( $post->ID, '_noindex_seo_noimageindex', true ); + $override = get_post_meta( $post->ID, '_noindex_seo_override', true ); + $noindex = get_post_meta( $post->ID, '_noindex_seo_noindex', true ); + $nofollow = get_post_meta( $post->ID, '_noindex_seo_nofollow', true ); + $noarchive = get_post_meta( $post->ID, '_noindex_seo_noarchive', true ); + $nosnippet = get_post_meta( $post->ID, '_noindex_seo_nosnippet', true ); + $noimageindex = get_post_meta( $post->ID, '_noindex_seo_noimageindex', true ); + $notranslate = get_post_meta( $post->ID, '_noindex_seo_notranslate', true ); + $max_snippet = get_post_meta( $post->ID, '_noindex_seo_max-snippet', true ); + $max_image_preview = get_post_meta( $post->ID, '_noindex_seo_max-image-preview', true ); + $max_video_preview = get_post_meta( $post->ID, '_noindex_seo_max-video-preview', true ); + $unavailable_after = get_post_meta( $post->ID, '_noindex_seo_unavailable_after', true ); + + // Normalize the value directives for display. + $max_snippet = noindex_seo_normalize_directive_value( 'max-snippet', $max_snippet ); + $max_image_preview = noindex_seo_normalize_directive_value( 'max-image-preview', $max_image_preview ); + $max_video_preview = noindex_seo_normalize_directive_value( 'max-video-preview', $max_video_preview ); + $unavailable_after = noindex_seo_normalize_directive_value( 'unavailable_after', $unavailable_after ); // Get global settings for reference. $global_directives = array(); - $directives = array( 'noindex', 'nofollow', 'noarchive', 'nosnippet', 'noimageindex' ); // Determine which context applies to this post type. $post_type = get_post_type( $post ); $context = ( 'page' === $post_type ) ? 'page' : 'single'; - foreach ( $directives as $directive ) { - if ( noindex_seo_get_setting( $context, $directive ) ) { - $global_directives[] = $directive; - } + $global_map = noindex_seo_get_context_directives_map( $context ); + foreach ( noindex_seo_format_directives( $global_map ) as $token ) { + $global_directives[] = $token; } ?>
-

+

-

+

-
-
-