This commit is contained in:
Javier Casares 2026-06-02 16:48:17 +00:00
commit a5d8d53047
5 changed files with 638 additions and 65 deletions

View file

@ -1,5 +1,37 @@
== Changelog == == Changelog ==
= 1.2.0 [2025-04-08] =
**Changes**
* Improved functions documentation.
**Fixes**
* The way the options are saved.
**Compatibility**
* WordPress: 4.1 - 6.8
* PHP: 5.6 - 8.4
**Tests**
* PHP Coding Standards: 3.12.1
* WordPress Coding Standards: 3.1.0
* Plugin Check (PCP): 1.4.0
= 1.1.1 [2024-11-04] =
**Added**
* Configuration option to dismiss other SEO plugin incompatibilities.
**Compatibility**
* WordPress: 4.1 - 6.7
* PHP: 5.6 - 8.4
= 1.1.0 [2024-11-02] = = 1.1.0 [2024-11-02] =
**Added** **Added**

344
languages/noindex-seo.pot Normal file
View file

@ -0,0 +1,344 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: noindex SEO\n"
"POT-Creation-Date: 2025-04-08 11:49+0200\n"
"PO-Revision-Date: 2025-04-08 11:49+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"X-Generator: Poedit 3.6\n"
"X-Poedit-Basepath: ..\n"
"X-Poedit-Flags-xgettext: --add-comments=translators:\n"
"X-Poedit-WPHeader: noindex-seo.php\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: "
"__;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: *.min.js\n"
#: noindex-seo.php:185
msgid "Settings"
msgstr ""
#. Plugin Name of the plugin/theme
#: noindex-seo.php:205 noindex-seo.php:206
msgid "noindex SEO"
msgstr ""
#. translators: plugin name.
#: noindex-seo.php:351
#, php-format
msgid ""
"noindex SEO has detected that %s is active. This may cause conflicts. Please "
"configure the options accordingly."
msgstr ""
#: noindex-seo.php:380
msgid "Permission denied or invalid nonce."
msgstr ""
#: noindex-seo.php:458
msgid "Main Pages"
msgstr ""
#: noindex-seo.php:461
msgid "Front Page"
msgstr ""
#: noindex-seo.php:462 noindex-seo.php:469 noindex-seo.php:481
#: noindex-seo.php:487 noindex-seo.php:495 noindex-seo.php:501
#: noindex-seo.php:512 noindex-seo.php:518 noindex-seo.php:529
#: noindex-seo.php:535 noindex-seo.php:541 noindex-seo.php:547
#: noindex-seo.php:553 noindex-seo.php:564 noindex-seo.php:570
#: noindex-seo.php:576 noindex-seo.php:587 noindex-seo.php:598
#: noindex-seo.php:609 noindex-seo.php:620 noindex-seo.php:626
#: noindex-seo.php:637
msgid "Recommended"
msgstr ""
#: noindex-seo.php:464
msgid "This will block the indexing of the site's front page."
msgstr ""
#: noindex-seo.php:468
msgid "Home"
msgstr ""
#: noindex-seo.php:471
msgid "This will block the indexing of the site's home page."
msgstr ""
#: noindex-seo.php:477
msgid "Pages and Posts"
msgstr ""
#: noindex-seo.php:480
msgid "Page"
msgstr ""
#: noindex-seo.php:483
msgid "This will block the indexing of the site's pages."
msgstr ""
#: noindex-seo.php:486
msgid "Privacy Policy"
msgstr ""
#: noindex-seo.php:489
msgid "This will block the indexing of the site's privacy policy page."
msgstr ""
#: noindex-seo.php:494
msgid "Single"
msgstr ""
#: noindex-seo.php:497
msgid "This will block the indexing of a post on the site."
msgstr ""
#: noindex-seo.php:500
msgid "Singular"
msgstr ""
#: noindex-seo.php:503
msgid "This will block the indexing of a post or a page of the site."
msgstr ""
#: noindex-seo.php:508
msgid "Taxonomies"
msgstr ""
#: noindex-seo.php:511
msgid "Category"
msgstr ""
#: noindex-seo.php:514
msgid ""
"This will block the indexing of the site categories. The lists where the "
"posts appear."
msgstr ""
#: noindex-seo.php:517
msgid "Tag"
msgstr ""
#: noindex-seo.php:520
msgid ""
"This will block the indexing of the site's tags. The lists where the posts "
"appear."
msgstr ""
#: noindex-seo.php:525
msgid "Dates"
msgstr ""
#: noindex-seo.php:528
msgid "Date"
msgstr ""
#: noindex-seo.php:531
msgid ""
"This will block the indexing of any date-based archive page (i.e., monthly, "
"yearly, daily, or time-based archive) of the site. The lists where the posts "
"appear."
msgstr ""
#: noindex-seo.php:534
msgid "Day"
msgstr ""
#: noindex-seo.php:537
msgid ""
"This will block the indexing of a daily archive of the site. The lists where "
"the posts appear."
msgstr ""
#: noindex-seo.php:540
msgid "Month"
msgstr ""
#: noindex-seo.php:543
msgid ""
"This will block the indexing of a monthly archive of the site. The lists "
"where the posts appear."
msgstr ""
#: noindex-seo.php:546
msgid "Time"
msgstr ""
#: noindex-seo.php:549
msgid ""
"This will block the indexing of an hourly, \"minutely\", or \"secondly\" "
"archive of the site. The lists where the posts appear."
msgstr ""
#: noindex-seo.php:552
msgid "Year"
msgstr ""
#: noindex-seo.php:555
msgid ""
"This will block the indexing of a yearly archive of the site. The lists "
"where the posts appear."
msgstr ""
#: noindex-seo.php:560
msgid "Archives"
msgstr ""
#: noindex-seo.php:563
msgid "Archive"
msgstr ""
#: noindex-seo.php:566
msgid ""
"This will block the indexing of any type of Archive page. Category, Tag, "
"Author, and Date-based pages are all types of Archives. The lists where the "
"posts appear."
msgstr ""
#: noindex-seo.php:569
msgid "Author"
msgstr ""
#: noindex-seo.php:572
msgid ""
"This will block the indexing of the author's page, where the author's "
"publications appear."
msgstr ""
#: noindex-seo.php:575
msgid "Post Type Archive"
msgstr ""
#: noindex-seo.php:578
msgid "This will block the indexing of any post type page."
msgstr ""
#: noindex-seo.php:583 noindex-seo.php:586
msgid "Pagination"
msgstr ""
#: noindex-seo.php:589
msgid ""
"This will block the indexing of the pagination, i.e., all pages other than "
"the main page of an archive."
msgstr ""
#: noindex-seo.php:594 noindex-seo.php:597
msgid "Search"
msgstr ""
#: noindex-seo.php:600
msgid "This will block the indexing of the internal search result pages."
msgstr ""
#: noindex-seo.php:605
msgid "Attachments"
msgstr ""
#: noindex-seo.php:608
msgid "Attachment"
msgstr ""
#: noindex-seo.php:611
msgid ""
"This will block the indexing of an attachment document to a post or page. An "
"attachment is an image or other file uploaded through the post editor's "
"upload utility. Attachments can be displayed on their own \"page\" or "
"template. This will not cause the indexing of the image or file to be "
"blocked."
msgstr ""
#: noindex-seo.php:616
msgid "Previews"
msgstr ""
#: noindex-seo.php:619
msgid "Customize Preview"
msgstr ""
#: noindex-seo.php:622
msgid ""
"This will block the indexing when content is being displayed in customize "
"mode."
msgstr ""
#: noindex-seo.php:625
msgid "Preview"
msgstr ""
#: noindex-seo.php:628
msgid ""
"This will block the indexing when a single post is being displayed in draft "
"mode."
msgstr ""
#: noindex-seo.php:633
msgid "Error Page"
msgstr ""
#: noindex-seo.php:636
msgid "Error 404"
msgstr ""
#: noindex-seo.php:639
msgid ""
"This will cause an error page to be blocked from being indexed. As it is an "
"error page, it should not be indexed per se, but just in case."
msgstr ""
#: noindex-seo.php:647
msgid "noindex SEO Settings"
msgstr ""
#: noindex-seo.php:653
msgid "General Configuration"
msgstr ""
#: noindex-seo.php:658
msgid "Plugin compatibility"
msgstr ""
#: noindex-seo.php:661
msgid ""
"Do not display the message of possible incompatibilities with other plugins."
msgstr ""
#: noindex-seo.php:666
msgid "SEO Configuration"
msgstr ""
#: noindex-seo.php:668
msgid ""
"Important note: if you have any doubt about any of the following items, it "
"is best not to activate the option as you could lose results in the search "
"engines."
msgstr ""
#: noindex-seo.php:691
msgid "View"
msgstr ""
#. Plugin URI of the plugin/theme
msgid "https://wordpress.org/plugins/noindex-seo/"
msgstr ""
#. Description of the plugin/theme
msgid ""
"Allows adding a meta-tag for robots noindex in specific parts of your "
"WordPress site."
msgstr ""
#. Author of the plugin/theme
msgid "Javier Casares"
msgstr ""
#. Author URI of the plugin/theme
msgid "https://www.javiercasares.com/"
msgstr ""

View file

@ -5,7 +5,7 @@
* Description: Allows adding a meta-tag for robots noindex in specific parts of your WordPress site. * Description: Allows adding a meta-tag for robots noindex in specific parts of your WordPress site.
* Requires at least: 4.1 * Requires at least: 4.1
* Requires PHP: 5.6 * Requires PHP: 5.6
* Version: 1.1.0 * Version: 1.2.0
* Author: Javier Casares * Author: Javier Casares
* Author URI: https://www.javiercasares.com/ * Author URI: https://www.javiercasares.com/
* License: GPL-2.0-or-later * License: GPL-2.0-or-later
@ -19,13 +19,19 @@
defined( 'ABSPATH' ) || die( 'Bye bye!' ); defined( 'ABSPATH' ) || die( 'Bye bye!' );
/** /**
* Outputs a 'noindex' meta robots tag to the page. * Outputs a 'noindex' directive in the meta robots tag.
* *
* This function ensures the 'noindex' directive is set in the robots meta tag, * This function adds a 'noindex' directive to the robots meta tag to instruct search engines
* instructing search engines not to index the content of the current page. * not to index the current page. It uses the `wp_robots` filter if available (WordPress 5.7+),
* or falls back to echoing a raw meta tag for older WordPress versions.
*
* Intended to be called only when certain conditions are met, such as in specific templates
* or based on plugin configuration.
* *
* @since 1.1.0 * @since 1.1.0
* *
* @see https://developer.wordpress.org/reference/hooks/wp_robots/
*
* @return void * @return void
*/ */
function noindex_seo_metarobots() { function noindex_seo_metarobots() {
@ -43,18 +49,23 @@ function noindex_seo_metarobots() {
} }
} }
/** /**
* Retrieves and sets the SEO 'noindex' values for various WordPress contexts. * Determines whether to output a 'noindex' meta tag based on page context and plugin settings.
* *
* This function optimizes option retrieval by fetching all relevant settings at once * This function checks the current page context (e.g., single post, category archive, 404 page, etc.)
* using transient caching, reducing the number of database queries. * and evaluates plugin settings to determine if a 'noindex' directive should be added to the meta robots tag.
* *
* @global WP_Post $post The post global for the current post, if within The Loop. * It retrieves settings efficiently using a transient cache. If the cache is not set, it pulls values
* from the WordPress options API and rebuilds the cache.
* *
* @return void * The list of contexts and their associated option keys can be filtered via the {@see 'noindex_seo_contexts'} filter.
* Once a matching context with 'noindex' enabled is found, it calls {@see noindex_seo_metarobots()} to apply the directive.
* *
* @since 1.1.0 * @since 1.1.0
*
* @global WP_Post $post The global post object, if available.
*
* @return void
*/ */
function noindex_seo_show() { function noindex_seo_show() {
/** /**
@ -135,6 +146,7 @@ function noindex_seo_show() {
// Iterate through the contexts and apply 'noindex' if the condition and setting are true. // Iterate through the contexts and apply 'noindex' if the condition and setting are true.
foreach ( $contexts as $context => $option_key ) { foreach ( $contexts as $context => $option_key ) {
if ( if (
isset( $current_conditions[ $context ] ) && isset( $current_conditions[ $context ] ) &&
$current_conditions[ $context ] && $current_conditions[ $context ] &&
@ -142,6 +154,7 @@ function noindex_seo_show() {
(bool) $options[ $option_key ] (bool) $options[ $option_key ]
) { ) {
noindex_seo_metarobots(); noindex_seo_metarobots();
break; // Prevent multiple meta tags from being added. break; // Prevent multiple meta tags from being added.
} }
} }
@ -155,13 +168,18 @@ add_action( 'admin_init', 'noindex_seo_register' );
add_action( 'admin_menu', 'noindex_seo_menu' ); add_action( 'admin_menu', 'noindex_seo_menu' );
/** /**
* Adds a 'Settings' link to the plugin action links on the plugins page. * Adds a "Settings" link to the plugin row actions on the Plugins admin screen.
*
* This function appends a direct link to the plugin's settings page within the list of action links
* shown for the plugin on the Plugins page (`/wp-admin/plugins.php`). This improves user accessibility
* by allowing quick access to the plugin's configuration page.
*
* Hooked to the {@see 'plugin_action_links_{plugin_basename}'} filter.
* *
* @since 1.0.0 * @since 1.0.0
* *
* @param array $links An array of action links already present for the plugin. * @param string[] $links Array of existing action links for the plugin.
* * @return string[] Modified array including the "Settings" link.
* @return array Returns the updated array of action links including the 'Settings' link.
*/ */
function noindex_seo_settings_link( $links ) { function noindex_seo_settings_link( $links ) {
$settings_link = '<a href="' . esc_url( admin_url( 'options-general.php?page=noindex_seo' ) ) . '">' . esc_html__( 'Settings', 'noindex-seo' ) . '</a>'; $settings_link = '<a href="' . esc_url( admin_url( 'options-general.php?page=noindex_seo' ) ) . '">' . esc_html__( 'Settings', 'noindex-seo' ) . '</a>';
@ -170,7 +188,13 @@ function noindex_seo_settings_link( $links ) {
} }
/** /**
* Adds a 'noindex SEO' options page to the WordPress admin menu. * Registers the "noindex SEO" settings page in the WordPress admin menu.
*
* This function adds an entry under the "Settings" menu in the WordPress admin area,
* which links to the plugin's main configuration page. The settings page is only accessible
* to users with the 'manage_options' capability.
*
* Internally uses {@see add_options_page()} to register the page.
* *
* @since 1.0.0 * @since 1.0.0
* *
@ -187,11 +211,18 @@ function noindex_seo_menu() {
} }
/** /**
* Registers settings for the 'noindex SEO' plugin. * Registers all settings used by the 'noindex SEO' plugin.
* *
* This function registers a variety of settings associated with the 'noindex SEO' functionality in WordPress. * This function registers individual options for each context in which the plugin
* Each setting determines whether specific pages or post types should be excluded from search engine indexing. * may apply a 'noindex' directive (e.g., single posts, category pages, archives, etc.).
* The settings values are integers, with a default value of 0 (which typically represents 'false' or 'off' in boolean context). * Each setting is stored as an integer (0 or 1), where 1 indicates that 'noindex' is enabled
* for that context.
*
* All settings are grouped under the option group 'noindexseo' and will be handled by the
* WordPress Settings API when the options form is submitted.
*
* Also registers the general configuration option 'noindex_seo_config_seoplugins'.
* A transient cache is cleared upon update using the {@see 'update_option_noindexseo'} action.
* *
* @since 1.0.0 * @since 1.0.0
* *
@ -227,6 +258,7 @@ function noindex_seo_register() {
); );
foreach ( $settings as $setting ) { foreach ( $settings as $setting ) {
register_setting( register_setting(
'noindexseo', 'noindexseo',
'noindex_seo_' . $setting, 'noindex_seo_' . $setting,
@ -237,12 +269,29 @@ function noindex_seo_register() {
); );
} }
register_setting(
'noindexseo',
'noindex_seo_config_seoplugins',
array(
'type' => 'integer',
'default' => 0,
)
);
// Hook to settings update to clear transient cache. // Hook to settings update to clear transient cache.
add_action( 'update_option_noindexseo', 'noindex_seo_clear_transient', 10, 2 ); add_action( 'update_option_noindexseo', 'noindex_seo_clear_transient', 10, 2 );
} }
/** /**
* Clears the transient cache when settings are updated. * Clears the cached plugin settings stored in the transient.
*
* This function deletes the 'noindex_seo_options' transient to ensure that updated
* option values are fetched fresh from the database on the next request. It is typically
* triggered after the plugin settings are updated to prevent stale data from being used.
*
* Hooked to the {@see 'update_option_noindexseo'} action.
*
* @since 1.0.0
* *
* @return void * @return void
*/ */
@ -251,55 +300,152 @@ function noindex_seo_clear_transient() {
} }
/** /**
* Detects conflicting SEO plugins and notifies the administrator. * Detects potential conflicts with other SEO plugins and displays an admin notice.
* *
* This function checks if any known conflicting SEO plugins are active. * This function checks for the presence of known SEO plugins that may conflict with
* If a conflict is detected, it displays an admin notice warning the user. * the functionality of 'noindex SEO'. If a conflicting plugin is active and the user
* has not opted to suppress warnings (via the 'noindex_seo_config_seoplugins' option),
* a dismissible admin notice is displayed to alert the site administrator.
* *
* @since 1.1.0. * The list of conflicting plugins includes popular SEO tools such as Yoast SEO, Rank Math,
* SEOPress, and others. The check is performed using {@see is_plugin_active()}.
* *
* @return void. * Hooked to the {@see 'admin_init'} action.
*
* @since 1.1.0
*
* @return void
*/ */
function noindex_seo_detect_conflicts() { function noindex_seo_detect_conflicts() {
// Include the plugin.php file if the function is not available.
if ( ! function_exists( 'is_plugin_active' ) ) {
include_once ABSPATH . 'wp-admin/includes/plugin.php';
}
// Define an associative array of conflicting plugins: slug/file => real plugin name. $option_config_seoplugins = get_option( 'noindex_seo_config_seoplugins', 0 );
$conflicting_plugins = array(
'all-in-one-seo-pack/all_in_one_seo_pack.php' => 'All in One SEO',
'premium-seo-pack/index.php' => 'Premium SEO Pack',
'seo-by-rank-math/rank-math.php' => 'Rank Math SEO',
'wp-seopress/seopress.php' => 'SEOPress',
'slim-seo/slim-seo.php' => 'Slim SEO',
'squirrly-seo/squirrly.php' => 'Squirrly SEO',
'autodescription/autodescription.php' => 'The SEO Framework',
'wordpress-seo/wp-seo.php' => 'Yoast SEO',
);
// Iterate through the conflicting plugins to check if any are active. if ( ! absint( $option_config_seoplugins ) ) {
foreach ( $conflicting_plugins as $plugin_path => $plugin_name ) {
if ( is_plugin_active( $plugin_path ) ) { // Include the plugin.php file if the function is not available.
// Add an admin notice if a conflicting plugin is active. if ( ! function_exists( 'is_plugin_active' ) ) {
add_action( include_once ABSPATH . 'wp-admin/includes/plugin.php';
'admin_notices', }
function () use ( $plugin_name ) {
echo '<div class="notice notice-warning is-dismissible"><p>'; // Define an associative array of conflicting plugins: slug/file => real plugin name.
// translators: plugin name. $conflicting_plugins = array(
printf( esc_html__( 'noindex SEO has detected that %s is active. This may cause conflicts. Please configure the options accordingly.', 'noindex-seo' ), esc_html( $plugin_name ) ); 'all-in-one-seo-pack/all_in_one_seo_pack.php' => 'All in One SEO',
echo '</p></div>'; 'premium-seo-pack/index.php' => 'Premium SEO Pack',
} 'seo-by-rank-math/rank-math.php' => 'Rank Math SEO',
); 'wp-seopress/seopress.php' => 'SEOPress',
break; // Stop checking after finding the first conflict. 'slim-seo/slim-seo.php' => 'Slim SEO',
'squirrly-seo/squirrly.php' => 'Squirrly SEO',
'autodescription/autodescription.php' => 'The SEO Framework',
'wordpress-seo/wp-seo.php' => 'Yoast SEO',
);
// Iterate through the conflicting plugins to check if any are active.
foreach ( $conflicting_plugins as $plugin_path => $plugin_name ) {
if ( is_plugin_active( $plugin_path ) ) {
// Add an admin notice if a conflicting plugin is active.
add_action(
'admin_notices',
function () use ( $plugin_name ) {
echo '<div class="notice notice-warning is-dismissible"><p>';
// translators: plugin name.
printf( esc_html__( 'noindex SEO has detected that %s is active. This may cause conflicts. Please configure the options accordingly.', 'noindex-seo' ), esc_html( $plugin_name ) );
echo '</p></div>';
}
);
break; // Stop checking after finding the first conflict.
}
} }
} }
} }
add_action( 'admin_init', 'noindex_seo_detect_conflicts' ); add_action( 'admin_init', 'noindex_seo_detect_conflicts' );
/** /**
* Displays the administration settings page for the 'noindex SEO' plugin. * Processes the form submission for the 'noindex SEO' plugin settings.
*
* This function handles the saving of plugin options submitted from the custom admin form.
* It first verifies the current user's capability and nonce for security. Then it resets all
* registered context options to `0`, and selectively updates those submitted as checked in the form.
*
* Additionally, it updates the general configuration setting `noindex_seo_config_seoplugins`,
* clears the plugin's transient cache, and redirects back to the settings page.
*
* Hooked to the {@see 'admin_post_update_noindex_seo'} action.
*
* @since 1.2.0
*
* @return void
*/
function noindex_seo_process_form() {
if ( ! current_user_can( 'manage_options' ) || ! check_admin_referer( 'update_noindex_seo_nonce' ) ) {
wp_die( esc_html__( 'Permission denied or invalid nonce.', 'noindex-seo' ) );
}
$settings = array(
'error',
'archive',
'attachment',
'author',
'category',
'comment_feed',
'customize_preview',
'date',
'day',
'feed',
'front_page',
'home',
'month',
'page',
'paged',
'post_type_archive',
'preview',
'privacy_policy',
'robots',
'search',
'single',
'singular',
'tag',
'time',
'year',
);
// Reset all options to 0.
foreach ( $settings as $setting ) {
update_option( 'noindex_seo_' . $setting, 0 );
}
// Save only active options (checked checkboxes).
foreach ( $settings as $setting ) {
if ( isset( $_POST[ 'noindex_seo_' . $setting ] ) ) {
update_option( 'noindex_seo_' . $setting, 1 );
}
}
// Save general configuration option.
update_option(
'noindex_seo_config_seoplugins',
isset( $_POST['noindex_seo_config_seoplugins'] ) ? 1 : 0
);
// Clear cache.
delete_transient( 'noindex_seo_options' );
wp_safe_redirect( admin_url( 'options-general.php?page=noindex_seo&updated=true' ) );
exit;
}
add_action( 'admin_post_update_noindex_seo', 'noindex_seo_process_form' );
/**
* Renders the settings page for the 'noindex SEO' plugin in the WordPress admin.
*
* This function outputs the full HTML for the plugin's settings interface, including:
* - General configuration (e.g., disabling conflict notices)
* - A structured list of SEO-related options grouped by context (main pages, archives, taxonomies, etc.)
*
* Each context is represented as a checkbox that allows the administrator to enable or disable
* the `noindex` meta directive for that specific section of the site.
*
* The form is submitted via `admin-post.php` and processed by {@see noindex_seo_process_form()}.
* Security is enforced with a nonce field. Options are retrieved using `get_option()` for each field.
* *
* @since 1.0.0 * @since 1.0.0
* *
@ -499,15 +645,30 @@ function noindex_seo_admin() {
?> ?>
<div class="wrap"> <div class="wrap">
<h1><?php echo esc_html( __( 'noindex SEO Settings', 'noindex-seo' ) ); ?></h1> <h1><?php echo esc_html( __( 'noindex SEO Settings', 'noindex-seo' ) ); ?></h1>
<form method="post" action="options.php"> <form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
<input type="hidden" name="action" value="update_noindex_seo">
<?php <?php
settings_fields( 'noindexseo' ); wp_nonce_field( 'update_noindex_seo_nonce' );
do_settings_sections( 'noindexseo' ); // In case you have sections added later.
echo '<h2>' . esc_html( __( 'General Configuration', 'noindex-seo' ) ) . '</h2>';
echo '<table class="form-table">';
// Get current configuration value.
$option_config_seoplugins = get_option( 'noindex_seo_config_seoplugins', 0 );
echo '<tr>';
echo '<th scope="row"><label for="noindex_seo_config_seoplugins">' . esc_html( __( 'Plugin compatibility', 'noindex-seo' ) ) . '</label></th>';
echo '<td><fieldset>';
echo '<input type="checkbox" id="noindex_seo_config_seoplugins" name="noindex_seo_config_seoplugins" value="1" ' . checked( 1, $option_config_seoplugins, false ) . '> ';
echo '<span class="description">' . esc_html( __( 'Do not display the message of possible incompatibilities with other plugins.', 'noindex-seo' ) ) . '</span>';
echo '</fieldset></td>';
echo '</tr>';
echo '</table>';
echo '<h2>' . esc_html( __( 'SEO Configuration', 'noindex-seo' ) ) . '</h2>';
?> ?>
<p><?php echo esc_html( __( 'Important note: if you have any doubt about any of the following items, it is best not to activate the option as you could lose results in the search engines.', 'noindex-seo' ) ); ?></p> <p><?php echo esc_html( __( 'Important note: if you have any doubt about any of the following items, it is best not to activate the option as you could lose results in the search engines.', 'noindex-seo' ) ); ?></p>
<?php <?php
foreach ( $sections as $section_id => $section ) { foreach ( $sections as $section_id => $section ) {
echo '<h2>' . esc_html( $section['title'] ) . '</h2>'; echo '<h3>' . esc_html( $section['title'] ) . '</h3>';
echo '<table class="form-table">'; echo '<table class="form-table">';
foreach ( $section['fields'] as $field_id => $field ) { foreach ( $section['fields'] as $field_id => $field ) {
// Check for conditional display. // Check for conditional display.
@ -523,6 +684,7 @@ function noindex_seo_admin() {
echo '<td><fieldset>'; echo '<td><fieldset>';
echo '<input type="checkbox" id="noindex_seo_' . esc_attr( $field_id ) . '" name="noindex_seo_' . esc_attr( $field_id ) . '" value="1" ' . checked( 1, $option, false ) . '> '; echo '<input type="checkbox" id="noindex_seo_' . esc_attr( $field_id ) . '" name="noindex_seo_' . esc_attr( $field_id ) . '" value="1" ' . checked( 1, $option, false ) . '> ';
echo esc_html( $field['recommended'] ) . ': <span class="dashicons ' . ( $field['suggestion'] ? 'dashicons-yes' : 'dashicons-no' ) . '" title="' . ( $field['suggestion'] ? 'Yes' : 'No' ) . '"></span>. '; echo esc_html( $field['recommended'] ) . ': <span class="dashicons ' . ( $field['suggestion'] ? 'dashicons-yes' : 'dashicons-no' ) . '" title="' . ( $field['suggestion'] ? 'Yes' : 'No' ) . '"></span>. ';
echo '<span class="description">' . esc_html( $field['description'] ) . '</span>'; echo '<span class="description">' . esc_html( $field['description'] ) . '</span>';
if ( isset( $field['view_url'] ) ) { if ( isset( $field['view_url'] ) ) {
@ -532,8 +694,10 @@ function noindex_seo_admin() {
echo '</fieldset></td>'; echo '</fieldset></td>';
echo '</tr>'; echo '</tr>';
} }
echo '</table>'; echo '</table>';
} }
?> ?>
<?php submit_button(); ?> <?php submit_button(); ?>
</form> </form>

View file

@ -2,10 +2,10 @@
Contributors: javiercasares Contributors: javiercasares
Tags: seo, noindex Tags: seo, noindex
Requires at least: 4.1 Requires at least: 4.1
Tested up to: 6.7 Tested up to: 6.8
Stable tag: 1.1.0 Stable tag: 1.2.0
Requires PHP: 5.6 Requires PHP: 5.6
Version: 1.1.0 Version: 1.2.0
License: GPL-2.0-or-later License: GPL-2.0-or-later
License URI: https://spdx.org/licenses/GPL-2.0-or-later.html License URI: https://spdx.org/licenses/GPL-2.0-or-later.html
@ -81,11 +81,43 @@ Extract the contents of the ZIP and upload the contents to the `/wp-content/plug
== Compatibility == == Compatibility ==
* WordPress: 4.1 - 6.7 * WordPress: 4.1 - 6.8
* PHP: 5.6 - 8.4 * PHP: 5.6 - 8.4
== Changelog == == Changelog ==
= 1.2.0 [2025-04-08] =
**Changes**
* Improved functions documentation.
**Fixes**
* The way the options are saved.
**Compatibility**
* WordPress: 4.1 - 6.8
* PHP: 5.6 - 8.4
**Tests**
* PHP Coding Standards: 3.12.1
* WordPress Coding Standards: 3.1.0
* Plugin Check (PCP): 1.4.0
= 1.1.1 [2024-11-04] =
**Added**
* Configuration option to dismiss other SEO plugin incompatibilities.
**Compatibility**
* WordPress: 4.1 - 6.7
* PHP: 5.6 - 8.4
= 1.1.0 [2024-11-02] = = 1.1.0 [2024-11-02] =
**Added** **Added**
@ -126,6 +158,6 @@ This plugin adheres to the following security measures and review protocols for
== Vulnerabilities == == Vulnerabilities ==
* No vulnerabilities have been published up to version 1.1.0. * No vulnerabilities have been published up to version 1.2.0.
Found a security vulnerability? Please report it to us privately at the [WPVulnerability GitHub repository](https://github.com/javiercasares/noindex-seo/security/advisories/new). Found a security vulnerability? Please report it to us privately at the [noindex SEO GitHub repository](https://github.com/javiercasares/noindex-seo/security/advisories/new).

View file

@ -28,4 +28,5 @@ if ( defined( 'ABSPATH' ) && defined( 'WP_UNINSTALL_PLUGIN' ) ) {
delete_option( 'noindex_seo_preview' ); delete_option( 'noindex_seo_preview' );
delete_option( 'noindex_seo_customize_preview' ); delete_option( 'noindex_seo_customize_preview' );
delete_option( 'noindex_seo_time' ); delete_option( 'noindex_seo_time' );
delete_option( 'noindex_seo_config_seoplugins' );
} }