John Davidson

php - WordPress shortcode with quotation marks

0 comments
Message:


I need to have quotation marks in my shortcode parameter like this:


[shortcode filter="taxonomies.pa_color:"red" AND visible:true AND stock>0"]

As you can imagine, the shortcode doesn't work like this.
Unfortunately I can't change or remove the quotation marks.
Is there any way to enter the value with "?


I tried to use " instead of " like this:


[shortcode filter="taxonomies.pa_color:"red" AND visible:true AND stock>0"]

But it doesn't work either.


Escaping the " with \" also has no positive effect.


Is there any other way to do it?


I can't make extra parameters for the values because it's never clear which and how many attributes will be used in the shortcode.



My Answer:
One way to include quotation marks in a WordPress shortcode parameter is to use the HTML entity for quotation marks, which is ".

So your shortcode would look like this:

[shortcode filter="taxonomies.pa_color:"red" AND visible:true AND stock>0"]

This should allow you to include quotation marks within the parameter value.

Rate this post

5 of 5 based on 5096 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us