Thank you for contacting us here in the Support Forum
This is the expected behavior since Views 1.11.1
It is expected because Views is and never was intended to be a Software to provide Data, but to display it.
Our Developers are though considering a new feature, so to choose by settings if to Provide Data with a certain View, or display it.
For now, you would need to follow the below instructions.
Apply the below filter to your View, in functions.php:
add_filter( 'wpv_filter_wpv_view_shortcode_output', 'prefix_clean_view_output', 5, 2 );
function prefix_clean_view_output( $out, $id ) {
if ( $id == '375' ) { //Adjust this ID to your View's ID
$start = strpos( $out, '<!-- wpv-loop-start -->' );
if (
$start !== false
&& strrpos( $out, '<!-- wpv-loop-end -->', $start ) !== false
) {
$start = $start + strlen( '<!-- wpv-loop-start -->' );
$out = substr( $out , $start );
$end = strrpos( $out, '<!-- wpv-loop-end -->' );
$out = substr( $out, 0, $end );
}
}
return $out;
}
What it does:
- It hooks early in the View output.
- Priority 5 is mandatory as we already do some other cleaning at priority 10.
- It only affects a View with an ID of 375, adjust acordingly if needed.
- It only affects Views with actual results: if the View matches no result, the same “No items found” or whatever you have between the wpv-no-items-found shortcode applies.
- It returns only what is between the HTML comments <!– wpv-loop-start –> and <!– wpv-loop-end –> , excluding them. Only content between those HTML comments is returned, as is.
Notice that, with this applied to a given View ID:
- Pagination, specially AJAX pagination, will not work.
- Parametric search, specially AJAXed parametric search, will not work.
- Other future features will not work either.
But also notice that this only clears the View structure.
Building as example JSON inside a View output is wrong because we can not address quoting problems.
It is not the best approach, generally speaking in terms of Best Coding Practices.
This user here provided a Custom Solution to this as well:
https://toolset.com/forums/topic/error-using-cred_generic_field-to-let-user-select-the-post-author/#post-347121
Please let me know if the above solution works for you, I look forward to your reply!
Thank you for your patience.