Double quotes in query
-
Hi there,
I wonder if you can help, I need to add double quotes into the query below:
meta_key=”post_authors” meta_value=”‘.get_the_ID().'” meta_compare=”LIKE” meta_type=”CHAR”
So that it searches for ‘”‘ . get_the_ID() . ‘”‘ with the surrounding double quotes so it matches the following WP_Query
‘meta_query’ => array(
array(
‘key’ => ‘post_authors’, // name of custom field
‘value’ => ‘”‘ . get_the_ID() . ‘”‘,
‘compare’ => ‘LIKE’
)
)This then ensures that it matches the values exactly within the field ie “123”, not just 123. This prevents a match for “1234”
I’ve tried a couple of things but sadly no luck, any help would be so much appreciated :).
Many thanks,
TJ
- The topic ‘Double quotes in query’ is closed to new replies.