• Tom

    (@ideawrights)


    It’s too late to reply to the person who wrote a bad review because this only works on pages (which is in the title of the plugin, so no surprise).

    So… currently, it doesn’t work on anything. It does not appear to be compatible with the block editor.

    Here’s what I wrote after looking at the code, before I realized this does not work in modern WP

    —————–

    But this is a VERY simple plugin. You could easily fork it or just assume the developer will not update it, given that it has been seven years. But all you would need to do is find these lines at the top of noindex-pages.php

    // Filterable list of post types which will show the checkbox and add the meta tag
    function noinp_post_types() {
    return apply_filters( 'noindex-pages-post-types', array( 'page' ) );
    }

    And change the array definition to include whatever post types you want like

    array ('page', 'post', 'my-custom-content-type')

    Haven’t tried it, but looking at the rest of the code, both the save and display functions are simply checking against that array, so it should work just fine.

    Security

    Another review asked about security. I was worried about this too given how old it is. The only allowed user input is to check or not the checkbox when a post is saved, so there is no real opportunity for a brute force or XSS attack against this as far as I can see.

    Future compatibility

    Because this is so simple, there’s not much here. I checked this with Rector against PHP 7.4. and PHP 8.1 and there were no flags. This code works with current versions of PHP as of 2023.

    I did not check the WP API functions, but it uses only the most basic functions like wp_enqueue_style() or get_post_type().

    So despite the age of this plugin and the lack of support, I have no reservations about using it and I very much like how light it is – simple plugin that does one thing and one thing only.

    • This topic was modified 1 year, 10 months ago by Tom.
    • This topic was modified 1 year, 10 months ago by Tom.
  • The topic ‘Blog posts noindex, security, Block editor and PHP compatibility’ is closed to new replies.