Title: Infinite loop when saving custom post
Last modified: March 27, 2020

---

# Infinite loop when saving custom post

 *  Resolved [alexene22](https://wordpress.org/support/users/alexene22/)
 * (@alexene22)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/infinite-loop-when-saving-custom-post/)
 * Hello,
    I created a form using ACFE, with the Action to Create Post and with 
   Save settings to my custom post type and Save all ACF fields. When I try to save
   the form in the front-end, it just goes to an infinite-loop and a lot of CPT 
   items are created. Why is this happening? Thank you!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Finfinite-loop-when-saving-custom-post%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Konrad Chmielewski](https://wordpress.org/support/users/hwk-fr/)
 * (@hwk-fr)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/infinite-loop-when-saving-custom-post/#post-12591976)
 * Hello,
 * Thanks for the feedback!
 * I tested the code, and it looks like the infinite loop is inside your PHP code(
   it’s not a HTTP inifinite loop).
 * Do you have any particular code on hooks like `acf/save_post`?
 * Can you please share a screenshot of your Dynamic Form configuration?
 * Thanks.
 * Regards.
 *  Thread Starter [alexene22](https://wordpress.org/support/users/alexene22/)
 * (@alexene22)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/infinite-loop-when-saving-custom-post/#post-12592027)
 * I have no code yet inserted anywhere. I just started the project.
    Do you want
   me to give you access?
 *  Thread Starter [alexene22](https://wordpress.org/support/users/alexene22/)
 * (@alexene22)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/infinite-loop-when-saving-custom-post/#post-12592216)
 * I cannot share a screenshot, there is no image option in this editor.
 *  Thread Starter [alexene22](https://wordpress.org/support/users/alexene22/)
 * (@alexene22)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/infinite-loop-when-saving-custom-post/#post-12592432)
 * The custom post type that I use is created with the CPT UI plugin, not with ACFE.
   
   I am using Elementor and I am used with the CPT UI plugin. Might this be the 
   problem?
 *  Plugin Author [Konrad Chmielewski](https://wordpress.org/support/users/hwk-fr/)
 * (@hwk-fr)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/infinite-loop-when-saving-custom-post/#post-12592452)
 * Hello,
 * You can use [https://imgur.com/](https://imgur.com/) to upload image.
 * Maybe you could join the ACF Slack community here: [https://join.slack.com/t/wpacf/shared_invite/enQtODc2MjczMzM3NzQ1LTQxNmY2ZGY3OTU2NDkxNTliYmNhMmY1NDMwZGM4NmYxNzgwZTI5MDUzMDFlMGQ5YzcwNDc0ZWM0MDVmODI4NmI](https://join.slack.com/t/wpacf/shared_invite/enQtODc2MjczMzM3NzQ1LTQxNmY2ZGY3OTU2NDkxNTliYmNhMmY1NDMwZGM4NmYxNzgwZTI5MDUzMDFlMGQ5YzcwNDc0ZWM0MDVmODI4NmI)
 * It’s easier to discuss and debug stuff
 *  Plugin Author [Konrad Chmielewski](https://wordpress.org/support/users/hwk-fr/)
 * (@hwk-fr)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/infinite-loop-when-saving-custom-post/#post-12595044)
 * Found the problem.
 * It is a nasty bug caused by both Elementor & YOAST. Here are some explanations:
   On each new post creation, YOAST check the new post content for their “Link Checker”
   feature.
 * When YOAST do that check, it retrieve the post content, but each time the post
   content is retrieved, Elementor get in the action, and apply all shortcodes (
   including the Dynamic Form shortcode), which cause an infinite loop because the
   shortcode create new post on submission…
 * For people using the both plugins, here is the fix:
 * In the file: `/acf-extended/includes/modules/form/actions/post.php` `line:300`
 * Add the following code:
 * `add_filter('wpseo_should_index_links', '__return_false');`
 * Right before this part:
 * `$_post_id = wp_insert_post(array( ...`
 * This fix will be included in the next ACF Extended patch. I’m opening a bug report
   on both Elementor & YOAST repo.
 * Regards.
 * Edit:
 * Elementor bugreport: [https://github.com/elementor/elementor/issues/10998](https://github.com/elementor/elementor/issues/10998)
   
   YOAST bugreport: [https://github.com/Yoast/wordpress-seo/issues/14643](https://github.com/Yoast/wordpress-seo/issues/14643)

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Infinite loop when saving custom post’ is closed to new replies.

 * ![](https://ps.w.org/acf-extended/assets/icon-256x256.png?rev=2071550)
 * [Advanced Custom Fields: Extended](https://wordpress.org/plugins/acf-extended/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/acf-extended/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/acf-extended/)
 * [Active Topics](https://wordpress.org/support/plugin/acf-extended/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/acf-extended/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/acf-extended/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Konrad Chmielewski](https://wordpress.org/support/users/hwk-fr/)
 * Last activity: [6 years, 2 months ago](https://wordpress.org/support/topic/infinite-loop-when-saving-custom-post/#post-12595044)
 * Status: resolved