Closed jorams closed 1 year ago
Hi @jorams
The image link you added to the filter is invalid. Can you please try adding a valid image link like https://example.com/image.png
?
@pratikrm I have, the specific string is not relevant as long as it's not empty nor whitespace-only.
The code that effectively gets run is this:
$filter_image_url = trim( 'https://example.com' );
if ( ! empty( $filter_image_url ) && $filter_image_url !== $attachment['url'] ) {
The crash happens on the right side of the &&
in the use of the variable $attachment
, which is not affected by the filter.
Hi @jorams
Thanks for sharing the details. I have logged it as a bug and we'll make sure to include the changes you mentioned in the next update.
@pratikrm is there a plan to revert how the open graph image filter function works? There seems to be no way to bypass how RankMath now validates if it's a valid image extension and strips the query string. My plugin that I made generates urls using query strings with no file extension and ends up returning nothing now when using the open graph filter settings.
@someguy9
Yeah, we are going to release an update soon to allow query strings added using the filter in opengraph image.
For now, to fix the issue please remove this block of the code in the plugin: https://github.com/rankmath/seo-by-rank-math/blob/master/includes/opengraph/class-image.php#L243-L251
@pratikrm thank you! I'll await the fix! (it's for a user of my plugin so an actual release is preferred).
Closing as it is fixed in v1.0.101
Describe the bug Using the filter to change an OpenGraph Image crashes the page.
A workaround is to configure a default OpenGraph thumbnail for the entire site. Only configuring an OpenGraph image for the specific page does not work.
To Reproduce
Expected behavior A rendered page with a
twitter:image
meta tag containing the URLhttps://example.com/
.Instead, the page crashes with the following error:
Additional context
The call to
add_image
was added in version 1.0.100 (not in this repository yet, it's line 349 here)The change that breaks it was added in version 1.0.100.1 (not in this repository yet, it's line 226 here).
This last change assumes
$attachment
is an array with a keyurl
, while it defaults to being an empty string.The following patch fixes it: