So I have a custom cornerstone element that I’ve been using for years, and it has stopped working properly with the newest versions of WordPress and X Theme / Pro (I’ve tested with both).
Basically what happens is that when you save the image using the parameters in the cornerstone editor, it saves the SRC as the ID of the image and then the thumbnail size you want. it doesn’t actually figure out the proper URL.
I’ve looked into the database to see how it is saving the shortcode, and it actually saves it wrong there.
So for example, the generated shortcode SHOULD be:
[custom_element graphic=“http://example.com/wp-content/uploads/example-image.jpg”]
But instead, what you end up with is:
[custom_element graphic=“123:full”]
The image ID is 123 and I chose full-size, and that’s what it does with it. This worked even just a couple weeks ago.
The functionality being used here is something built-in to the theme and/or Cornerstone, so I’m not really sure how to accommodate it.
What changed and what do I need to do to fix it?
Note that I tested on two very different sites. I tried with older PHP versions and also 7.3. It works fine with everything until I’m using the newest version of WordPress and X Theme or Pro, and then it stops working (note that it doesn’t affect previous instances of the element unless I try to swap out the image)
For reference, here is the snippet of code we have in our file to generate the controls and parameters for our element:
'graphic' => array(
'type' => 'image',
'ui' => array(
'title' => __( 'Image', 'si-custom-elements' ),
'condition' => array(
'graphic' => 'image'
)
)
I don’t really think anything else is relevant, as it just spits out that broken URL (123:full) if the image is defined, or our default image URL we defined if not. So those parts work as intended.
It’s literally just the use of an “Image” parameter within Cornerstone.
The “Classic Image” element appears to continue working (though it appears to have been updated).
Any ideas?