I have a little problem and for the life of me I can’t find a solution. I have a custom box (textarea) in my theme options page and users can insert html & shortcodes that are displayed on the front page. But, I have a user that on his server the shortcodes will not execute. It is just echoing the shortcode instead.
The shortcodes work perfect on my local xampp install and all of my servers. I guess they work on 99,9% of the users using the theme. There is only 1 user that sent me this problem. He gave me a test username and pw on his site and I’ve tried almost anything and I’m yet to find a fix. I have never encountered this.
Oh, and the shortcodes work fine in posts or pages. They just don’t work anywhere else when called with “echo do_shortcode”. None of them. It is simply echoing the shortcode.
I think I’m going crazy. I won’ have rest until I find the fix
Oh, and the shortcodes work fine in posts or pages. They just don’t work anywhere else when called with “echo do_shortcode”. None of them. It is simply echoing the shortcode.
Clearly that points to a problem with the function echo do_shortcode? Does it not?
^^Hmm, not looked into that but the above could work…
To me it just sounds like a issue with Wordpress not parsing the shortcodes when called from a function.
I would look into exactly how Wordpress parse the shortcodes from a post or page… A solution might lie there. I’m willing to bet this has nothing to do with the server configuration on this particular client and more to do with how Wordpress parses and converts shortcodes when called directly from that function.
Or there is something wrong with your custom function… or the parameters you are sending it is garbage…
@SaurabhSharma: I did try that last night because he has the “magic quotes” enabled. No luck though.
@iamthwee: I thought about that but I don’t think this is the problem. I’ve tried with the most simple shortcode ever that I’m sure 100% is working for anyone. Still, no luck. And it’s the first user that reports this. I had over 1200 sales and no one ever complained about this.
Maybe he’s running a plugin that’s filtering out the shortcodes. I highly doubt it’s an issue with WordPress Core. Most likely something else in their installation is breaking things.
To be sure, echo the content of $data[‘custom_section_content’] just to be sure it is what you expect it to be.
Hey thanks, didn’t think of that. I just did it and it’s echoing the right thing, still the shortcode won’t execute.
If I echo $data[‘custom_content_section’] I get this for example:
[one_third] TEST TEST [/one_third]
If I echo do_shortcode($data[‘custom_content_section’]) I get the same result. The only plugins are the WP default ones and are both deactivated. Still no luck.
Edit: BTW, is there any other function to run shortcodes out of the query besides do_shortcode? I read something about “apply_filter” but it’s only working for “the_content”.
Just throwing ideas… but assuming nothing is wrong with the shortcode like you have an extra space somewhere, I would try to re- upload the shortcodes.php which is in the wp-includes directory.
You guys rock. Thanks for all the answers. I’ve managed to fixed it. Still, I don’t know what the problem was although I have a feeling that had something to do with the encoding of the file. I removed the “functions.php” file from the server and added it again from my computer. Now it seems it’s working.