-2

I have a custom field manually coded using CMB2: https://cmb2.io/. Here is the code:

$cmb_pages_customtext->add_field( array(
        'name'  => esc_html__( 'Content', 'defaulttheme' ),
        'id'    => $prefix . 'customtext_content',
        'type'  => 'wysiwyg',
        'sanitization_cb' => false,
    ));

I want to be able to add an iframe to the custom field. When I add the iframe code to the field, it saves it in the page edit screen but the iframe doesn't display when viewing the actual page. Is there something I need to add to get the iframe to display on the actual page?

1
  • I don't know why I got downvoted. My question was for a specific problem in WordPress.
    – mdailey77
    Commented Apr 2, 2018 at 21:25

2 Answers 2

0

how do you assign the variable? use something like this?

$variable = esc_html( get_post_meta(get_the_ID(), 'example', true) );

if yes, try removing esc_html()

-2

I actually figured out the problem. It was a wp_kses_post function that was the cause. The wp_kses_post function was stripping the iframe tag. Obviously I removed the wp_kses_post function.

2
  • this is a very weak answer. ok, so that was the problem, how did you fix it? Commented Apr 2, 2018 at 15:24
  • It's a sufficient answer. I didn't think I needed to spell out the obvious solution of removing the wp_kses_post function. I added to my answer.
    – mdailey77
    Commented Apr 2, 2018 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.