Skip Navigation

[Cerrado] WordPress 4.2.3 update breaks shortcodes

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 208 respuestas, has 94 mensajes.

Last updated by Amir hace 6 a帽os, 5 meses.


@mirkos: Can you please do following for me?

Add following code to your theme's functions.php file

if( !function_exists('render_views_featured_image') ) {

	function render_views_featured_image( $atts ) {

		if( has_post_thumbnail() ) {

			$image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'slider' );
			return 'style="background-image:url('.$image[0].'); width='.$image[1].' height='.$image[2].'"';

		return '';

	add_shortcode( 'render-view-featured-img', 'render_views_featured_image');


Then use in your HTML like this

<div [render-view-featured-img] class="heroimage"></div>

Go to Views > Settings > Comatibility > Third-party shortcode arguments, and add "render-view-featured-img"

Let me know if this helps.



Awesome @ankit - any suggestions for a similar fix for an iframe?

Here's how I currently have it implemented:

<iframe width="640" height="390" src='[types field="pntv-embed" output="raw"][/types]' frameborder="0" allowfullscreen></iframe>

Where my "pntv-embed" looks like this:
hidden link

(I have another instance integrated where it's *just* the YouTube ID)


Hi Ankit

I have done as you say, to replace the code I had before which was:

<img src="[wpv-post-featured-image raw="true"]"/>

... but now the images aren't displaying at all - which is marginally better than the image-not-found icon.

See this page
hidden link

I'm probably using the right fix in the wrong place though. I don't suppose your fix returns the url of the featured image in the same way it is needed above.

Whilst at that page, note also the drop-down box in the left sidebar. It displays OK but the URLs it gives are thrown by 4.2.3 - you'll see the outcome if you select one. The code for this is outlined in my post last night:

I will listen out for a different fix for this.



@ankit: Thank you for your help - this workaround does work!


@timb: You are using double-quotes outside AND inside your shortcode - try this instead (worked for me):

 <img src="[wpv-post-featured-image raw='true']"/>

Hope this helps


Yes - thanks mirkoS - that did the trick... trying it on other uses of raw='true' around the site to see if it helps.


This is a huge problem for my company... follow...


@evans-2: Add this to functions.php of your theme

if( !function_exists('render_my_custom') ) {
    function render_my_custom( $atts ) {
	 $atts = shortcode_atts( array('field'=>'', 'output'=>'raw'), $atts);
         return types_render_field( $atts['field'], array("output" => $atts['output']));
    add_shortcode( 'render-my-field', 'render_my_custom');

Go to Views > Settings > Comatibility > Third-party shortcode arguments, and add "render-my-field"


<iframe width="640" height="390" src="[render-my-field field="pntv-embed" output="raw"]" frameborder="0" allowfullscreen></iframe>

Hope this helps.




Timezone: Europe/Madrid (GMT+01:00)

This is Juan, lead Views developer and also leader of the Toolset project itself.

First of all, I would like to thank you all for your patience and understanding. This is a really bad situation that came out of nowhere and we were as shocked as you were.

Long story short: we do think that we will be able to provide you all with a patched version of Views, based on 1.9, that should adress all or at least the most usual issues that you are experiencing. We have a huge test base that includes all the examples you already shared here, plus lots of custom tests, and up until now we are applying and testing a promising solution.

Our intention is to have this solution out and ready for usage within few hours.

Long story long: just below this 馃檪

We are working very hard at this very moment to get a patch for our plugins ready for you all ASAP. After checking with the WordPress core developers, it seems that they introduced a change in the shortcodes API itself, and stated new and tighter rules on where a shortcode can and can not be used. I will not enter into technical details, but there was a security hole to close, and anyway those are the rules we do have to play with from now on. It is worth mentioning that the change itself landed in the codebase just some hours before WordPress 4.2.3 was released. Also, note that this same patch was applied back until the 3.7 branch for WordPress so new versions were released from the 3.7 to the 4.2 branches.

The main problem here seems to be Views, which shortcodes have stopped working on a series in scenarios, involving HTML attributes and some other special cases. As you all might now, we do have a mechanism for registering shortcodes to be used inside other shortcodes, which works natively wth our own shortcodes, and where you can register your own ones. We are expanding this so we can render our (and registered third-party) shortcodes before the change in WordPress itself gets applied.

The WordPress core team in fact suggested to do something like that, since it is the same mechanism that some native shortcodes, like the ones dealing with embedded media elements, use.

Please stay tunned for updates. They will be announced ASAP.

Thanks again for being so lovely and loyals. This goes beyond product-client relationship: we are a community and we will grow stronger after this.



Hi guys,

I was doing some updates on our site when I noticed the shortcode issue. I've added the function to our child-theme, added the "render-my-field" to the shortcode compatibility page, but when I try edit my view template, now called content-templates, I just see a blank screen with a button to save all.

Any ideas?



Thanks for all your help guys. I'm making headway with this now.

The [render-my-field] shortcode is working when a url is called in html. However, I have numerous views in my site which show a list of post titles in a drop-down list. Pre 4.2.3, selecting one of the listings navigated to its url using the following code:

<option value="[wpv-post-url]">

This no longer works in 4.2.3 and I have tried...

<option value="[render-my-field field='[wpv-post-url]']">

But that doesn't work either...

So in case you don't have enough on your plate, I'm just wondering if there's a simple solution for referencing the post url in this syntax which will work in 4.2.3



... in case you hadn't fathomed it. My use of the "wpv-post-url" shortcode above, in square brackets, has rendered the url of this forum topic instead...


I managed to figure out how to access the view template (inside the view), so now it's just a case of figuring out why the new shortcodes aren't kicking in.

This is what I have in my child-themes functions.php:

if( !function_exists('render_my_custom') ) {

    function render_my_custom( $atts ) {

     $atts = shortcode_atts( array('field'=>'', 'output'=>'raw'), $atts);
         return types_render_field( $atts['field'], array("output" => $atts['output']));

    add_shortcode( 'render-my-field', 'render_my_custom');


Then my updated view template:

<ul class="list-reset floated-list">
  <li class="product-icon">
<a href="/[render-my-field field="block-name" output="raw"]" title="Learn more about [wpv-post-title]">
  <img src="/wp-content/blocks/[render-my-field field="block-name" output="raw"]/icon-[render-my-field field="block-name" output="raw"].png" alt="" border="0" width="75">
  <li class="product-content"><h3>[wpv-post-title] [wpv-if price="wpcf-price" evaluate="$price != 0"]<span>$[types field="price" format="FIELD_VALUE"][/types]</span>[/wpv-if][wpv-if price="wpcf-price" evaluate="$price = 0"]<span>Free!</span>[/wpv-if]</h3>
[wpv-if price="wpcf-price" evaluate="$price != 0"]<a href="[types field="extend-link" raw="true"][/types]" title="Learn more about [wpv-post-title raw="true"]" target="_blank">Buy</a><i></i>[/wpv-if]
[wpv-if price="wpcf-price" evaluate="$price = 0"]<a href="[types field="download-file-name" class="" style=""][/types]" title="Download the [wpv-post-title raw="true"] block" onclick="javascript: pageTracker._trackPageview('[types field="file-download" link="false" raw="true"][/types]');">Download</a><i></i>[/wpv-if]
<a href="/demo?selected=[render-my-field field="block-name" output="raw"]" title="Check out our [wpv-post-title raw="true"] block demo!" target="_blank">Demo</a><i></i>
<a href="/[render-my-field field="block-name" output="raw"]" title="Learn more about [wpv-post-title raw="true"]">Details</a>

Here is a screenie of my conflict settings:
hidden link

Any ideas why the shortcodes aren't working?


Follow~ 馃榾


I've got a site that uses featured images as the background image of the li in a sub page listing view. I've got over this new problem temporarily by writing the image url to a hidden div and then using jQuery to loop through each li and set the background image as the content of the hidden element. Very simple, not ideal as it can be slow but it's better than nothing.

Here's the view code:
<ul id="subNavigation">
<!-- wpv-loop-start -->

  • <div class="invisible">[wpv-post-featured-image size="full" output="url"]</div>
    <div class="overPanel">
  • </wpv-loop>
    <!-- wpv-loop-end -->

    and here's the jQuery:
    jQuery('#subNavigation').children("li").each(function( index ) {
    var bg = jQuery(this).children('.invisible').html();
    if(bg !=""){
    jQuery(this).css('background-image', 'url('+bg+')');

    here's the CSS:
    .invisible {display: none;}

    El debate ‘[Cerrado] WordPress 4.2.3 update breaks shortcodes’ est谩 cerrado y no admite m谩s respuestas.