stephanieleary / content-audit

Lets you create a content inventory right in the WordPress Edit screens. You can mark content as redundant, outdated, trivial, or in need of a review.
GNU General Public License v2.0
7 stars 7 forks source link

Quashed notice when the request does not contain a content_owner key #4

Closed mryand closed 5 years ago

mryand commented 7 years ago

This should resolve this issue:

https://wordpress.org/support/topic/errors-in-new-version/

mryand commented 7 years ago

Note that a slightly different change may be required on the version that is currently being served from the WP plugins site, since they seem to have different code structures (not super familiar with WP, so perhaps this is normal).

In content_audit_report.php:

function content_audit_posts_where( $where ) {
    global $wpdb;
    if ( isset( $_REQUEST['content_owner'] ) ) {
        $owner = absint( $_REQUEST['content_owner'] );
        if ( isset( $owner ) && !empty( $owner ) ) { 
            $where .= " AND ID IN ( SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_content_audit_owner' AND meta_value='{$owner}' )";
        }
    }   
    return $where;
}