Home Forums Trusted Pro Privacy export data requests list not showing.

Tagged: 

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #4728
    Adri Oosterwijk
    Participant

    Hi Andy,

    In this thread you provided me with this adjusted code to get the search options behave as it should in my case.

     

    Here is the final code provided:

    function trusted_woocommerce_search_form() {
    get_search_form();
    }
    
    function trusted_custom_search_filter( $query ) {
    if ( $query->is_search ) {
    $query->set( 'post_type', array( 'recipe', 'post', 'product', 'page' ) );
    $query->set( 'tax_query', array(
    array(
    'taxonomy' => 'product_visibility',
    'field' => 'name',
    'terms' => 'exclude-from-search',
    'operator' => 'NOT IN',
    )
    ) );
    }
    return $query;
    }
    add_filter( 'pre_get_posts', 'trusted_custom_search_filter' );
    

    The issue is right now that when this code is active te table of data export requests in the Privacy options of WordPress 4.9.6. are not showing. In the screenshot you can see there must be two of them but the table says, nothing found.

     

    Will you please look into it?

    Thanks in advance.

    Best wishes,

     

    Adri

    #4729
    Andy
    Keymaster

    Hi Adri

    Could you please try changing this line:
    add_filter( 'pre_get_posts', 'trusted_custom_search_filter' );

    to this:

    if ( !is_admin() ) {
    add_filter( 'pre_get_posts', 'trusted_custom_search_filter' );
    }
    #4730
    Adri Oosterwijk
    Participant

    Hi Andy,

    And again….. it works perfect.

    I’m happy with the solution but I’m not able to figure out what was wrong in the code. The solution now is: don’t fire the function when the user is admin and has the dashboard displayed. But what is causing the trouble in the first place? Any idea? Just curious….

    Adri

    #4731
    Andy
    Keymaster

    Short answer… the ‘pre_get_posts’ filter affects all post queries including the dashboard.
    I should have noticed this in my original code, sorry about that.

    If you’re interested in a more thorough answer, check these links:

    #4732
    Adri Oosterwijk
    Participant

    Hi Andy, thank you for your reply and explanation.

    I will read up about it with the links provided.

    This issue is resolved now.

    Have a great day!

    Adri

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Privacy export data requests list not showing.’ is closed to new replies.