• Resolved andersj

    (@andersj)


    Hi,

    I’m starting to make use of password protected pages in WordPress and hoping to hide them from being displayed in my front end loops.

    I’ve tried this after seeing somewhere I should be able to pass a has_password condition?

    $params = array(
    ‘limit’ => 3,
    ‘orderby’ => ‘post_date DESC’,
    ‘has_password’ => false
    );

    $news = pods( ‘news’, $params );

    while ( $news->fetch() ) {
    <stuff here>
    }

    Any guidance would be appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I ran your question through ChatGPT, it suggested the following. Try it out and let me know if that works:

    $params = array(
        'limit' => 3,
        'orderby' => 'post_date DESC',
        'where' => 'post_password = ""',
    );
    
    $news = pods('news', $params);
    
    while ($news->fetch()) {
        // Your code here
    }
    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @andersj

    The suggestion from @authentico seems good to me!
    In any case, this is a WordPress core question, not Pods related.

    Cheers, Jory

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Hide posts that have password set’ is closed to new replies.