Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thanks Hector. I tried that initially and received a php error at the $where = str_replace… line.

    May have been an error on my part; I’ll try again.

    Hi Hector:

    The code you noted above to include items marked as published or inherited:

    /**
     * Have WPP list attachments.
     *
     * @param string $where   Original WHERE clause from WPP_Query class.
     * @param array  $options Plugin settings.
     * return string
     */
    wp4649_wp_popular_attachments($where, $options){
        // Set post_status to "inherit"
        $where = str_replace("p.post_status = 'publish'", "p.post_status = 'inherit'", $where);
    
        return $where;
    }
    add_filter( 'wpp_query_where', 'wp4649_wp_popular_attachments', 10, 2 );

    In which file(s) should that code be added?

    Thanks.

    • This reply was modified 5 years, 11 months ago by marckw.
Viewing 2 replies - 1 through 2 (of 2 total)