Remove All Query Arg

You can explode URL by ? and take the first part:

$url = explode( '?', esc_url_raw( add_query_arg( array() ) ) );

$no_query_args = $url[0];

Leave a Comment