property_map embeds not saving
-
Hey All,
In case anyone’s been having an issue with the latest version not saving the property_map embeds or video embeds, I’ve posted some code updates below that should allow this to be fixed until the plugin is updated.In class-agentpress-listings.php, in function metabox_save add the following.
// Extra checks for _listing_map & _listing_video $raw_property_details = $_POST['ap']; if (array_key_exists('_listing_map', $raw_property_details)) { update_post_meta($post_id, '_listing_map', wp_kses_post($raw_property_details['_listing_map'])); } else { delete_post_meta($post_id, '_listing_map'); } if (array_key_exists('_listing_video', $raw_property_details)) { update_post_meta($post_id, '_listing_video', wp_kses_post($raw_property_details['_listing_video'])); } else { delete_post_meta($post_id, '_listing_video'); }
The basic issue is that the WP function ‘sanitize_text_fields’ is stripping the iframe embeds, so instead adding them separately and using wp_kses_post to sanitize the input fixes the issue. However, wp_kses_post will need customized itself to allow iframe input, however there is a quick and easy plugin you can use to allow this (not my work) at https://github.com/cferdinandi/gmt-allow-iframes. Also, it should be noted that some website hosting companies using mod_security will also block this (we ran into both issues), in which case you’ll need to get the host to whitelist the affected rules.
- The topic ‘property_map embeds not saving’ is closed to new replies.