Dear Sir/Madam,
I don't want to query/filter the post if there is no parameter passing.
Refer to screenshot, I find if I don't pass the url parameter, then the query will do and select the latest post as result. How can I disable the query if there is no url parameter?
Best regards,
Kelvin
I think in this case you should change the View's limit from "1" to "No limit". If no URL parameter is included, all results will be displayed. If a URL parameter is included, only the posts in the URL parameter will be displayed.
Dear Christian Cox,
I don't want to display all results if no URL parameter is included.
So you want to completely disable the View if the cid URL parameter is blank or not present? In that case, you can use a conditional to test the URL parameter value with wpv-search-term. The conditional might look like this:
[wpv-conditional if="( '[wpv-search-term param="cid"]' eq '' )"]
cid param is empty value or not present, like these URLs:
<em><u>enlace oculto</u></em>
<em><u>enlace oculto</u></em>
<em><u>enlace oculto</u></em>
<em><u>enlace oculto</u></em>
Do not place the View here
[/wpv-conditional]
[wpv-conditional if="( '[wpv-search-term param="cid"]' ne '' )"]
cid param is present and not empty value, like these URLs:
<em><u>enlace oculto</u></em>
<em><u>enlace oculto</u></em>
<em><u>enlace oculto</u></em>
<em><u>enlace oculto</u></em>
Place your View here using wpv-view shortcode
[/wpv-conditional]
I think this is the simplest way to achieve what you are looking for in wp-admin. Another solution is to use the Views API Filters like wpv_filter_query and wpv_filter_query_post_process to inspect the $_GET superglobal and modify the query or results programmatically.
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query_post_process