• Resolved Abigailm

    (@abigailm)


    Thank you for this excellent plugin

    I am trying to prevent the archived posts from showing on the front end — even to logged in administrators — so I followed the instructions in the FAQ – and put this code, exactly, in my functions.php file:

    function my_aps_default_read_capability( $capability ) {
        $capability = 'read';
    
        return $capability;
    }
    add_filter( 'aps_default_read_capability', 'my_aps_default_read_capability' );

    But the archived posts still show up. My goal is to have them disappear entirely from front-end view– no links, no searches, etc.

    Is there something else I need to add to the filter to make that happen. My coding skills are pretty rudimentary, so I am guessing there might be some basic step that I’m missing.

    https://ww.wp.xz.cn/plugins/archived-post-status/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Frankie Jarrett

    (@fjarrett)

    Hi Abigailm, actually that filter isn’t doing what you think.

    What the FAQ is describing is that any logged in user with the read_private_posts capability will be able to see them. This filter lowers that capability so that anyone with the read capability (which is basically everyone) can see the Archived content.

    1. Remove this code from your functions.php file.
    2. Log out of WordPress.
    3. Archived posts won’t be visible.

    As it says in the FAQ:

    Why are Archived posts appearing on the front-end?
    This is most likely because you are viewing your site while being logged in as an Editor or Administrator.

    More here on which users have which capabilities: http://codex.ww.wp.xz.cn/Roles_and_Capabilities#Capability_vs._Role_Table

    Thread Starter Abigailm

    (@abigailm)

    It’s been a while since I posted that comment.

    I think I got things working the way I want (archived posts not visible on the front end to any users, whatever the privilege level) with this code:

    function my_aps_default_read_capability( $capability ) {
        $capability = 'read';
        return $capability;
    }
    add_filter( 'aps_default_read_capability', 'my_aps_default_read_capability' );
    add_filter( 'aps_status_arg_public', '__return_false' );
    add_filter( 'aps_status_arg_private', '__return_false' );
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Problem/question using filter’ is closed to new replies.