#46402 closed defect (bug) (fixed)
wp_targeted_link_rel() corrupts serialized array data including ACF field settings.
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.3 | Priority: | normal |
Severity: | normal | Version: | 5.1 |
Component: | Formatting | Keywords: | dev-feedback has-patch has-unit-tests |
Focuses: | Cc: |
Description
Hi all,
In 43732, the wp_targeted_link_rel()
callback was added to filter content before it's saved to the database.
This addition is corrupting all serialized array data saved in post_content containing an <a>
element, and is breaking the Advanced Custom Fields plugin.
The Advanced Custom Fields uses the post_content value to save serialized array data for both its field and field group settings.
Users who include an <a>
element within the field "instructions" (or other field settings) are experiencing this issue first hand when their field no longer loads.
Serialized data is very useful, but is open to "corruption" by any change in character length.
Is it possible to improve the wp_targeted_link_rel()
function by avoiding serialized / JSON data?
I believe there is a related issue affecting JSON data 46316 which may also be solved by this improvement.
46402.diff is a suggestion how we could ignore entirely serialized content using is_serialized().
Within
is_serialized()
there are various checks before the regex matches kick in there, like if the trimmed content has:
as the second character. So in most cases when the content isn't entirely serialized, it shouldn't hit these extra regex matches inis_serialized()
.As the content of custom post types can be used for various data formats, I also wonder if the
wp_targeted_link_rel()
filtering should be made easier to remove per post type or post ID?