Support

Account

Home Forums Backend Issues (wp-admin) Prevent oembed fields from rendering in wp-admin

Helping

Prevent oembed fields from rendering in wp-admin

  • I set up a client’s home page to use Flexible Content and an oembed is one of the available blocks. Did not foresee them adding almost 200 Instagram posts to the page.

    Front end is cached and paginated so no speed problems there.

    However when trying to edit the page in wp-admin, it loads a every single oembed, which takes forever. Is there a way to prevent these oembeds from rendering just in wp-admin?

    Sorry if this is documented and I missed it – wasn’t able to find anything searching the forums or docs.

  • From what I see the only way to do this is to override the acf_field_oembed class. The file is located in the plugin directory under advanced-custom-fields-pro/includes/fields/class-acf-field-oembed.php. If you copy that file to your theme somewhere and include it via the functions file you can edit the render_field function directly to remove the oembed markup that is output. Just make sure you remove the IF condition that wraps the class so that your version of the class will always override the default ACF version.

    Unfortunately there’s no hook setup for the render_field function, and the output is coded directly in that function. There definitely should be a filter available for render_field across all field types, that would make it a lot easier to customize how all fields are rendered in admin.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.