Support » Plugin: AgentPress Listings » property_map embeds not saving

  • Resolved alexatg


    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 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.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi Alex,

    Thank you for reporting the issue you are having with the AgentPress Listings plugin. I have passed this along to our developers for review.

    Thank you!

    My video embeds aren’t saving after the latest update. Adding this code doesn’t help.


    • This reply was modified 3 years, 2 months ago by .

    I’m having the same issue, tried to solve it with the above code but didn’t work. Please, support team, fix this.

    Plugin Support Nick C


    Thank you for this report.

    I don’t have a timeline for a fix yet, but wanted to let you know the StudioPress team is aware, and will work to correct this in an update.

    Same issue

    Thanks for the patch @alexatg although it didn’t work for me. Looking forward to seeing the solution for this, thanks @modernnerd !

    Plugin Support Nick C


    Version 1.3.2 will be released to address this. (I don’t have a timeline yet, but likely to be this week.)

    Plugin Support Nick C


    Version 1.3.2 of AgentPress Listings is now out with a fix for the map and video embeds. Thanks for your patience, all!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘property_map embeds not saving’ is closed to new replies.