404 error
-
https://www.ads-software.com/support/topic/the-post-url-will-give-404-error
My problem is same like in the given link, I tried to use pre_get_posts to exclude archive posts only, but I got opposite result. My code is:add_filter( 'aps_status_arg_public', '__return_true' ); add_filter( 'aps_status_arg_private', '__return_false' ); add_filter( 'aps_status_arg_exclude_from_search', '__return_false' );
// Load our function when hook is set
add_action( 'pre_get_posts', 'rc_modify_query_exclude_category' ); function rc_modify_query_exclude_category( $query ) { // Check if on frontend and main query is modified if ( ! is_admin() && $query->is_main_query() && ! $query->get( 'post_status' ) ) { $query->set( 'post_status', 'archive' ); } // end if }
with this code, i got list of archived post only but I need to remove archived post, i am not good in php, can you or anyone help please ???
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘404 error’ is closed to new replies.