Home Forums General Issues Default content not working when using front-end form


Default content not working when using front-end form

  • Hi,
    I’m am using this script in my functions.php file to add default content to all of my new posts.

    function insert_default_content($content) {
    $content = '[xyz-ips snippet="Apartments"]';
    return $content;
    add_filter( 'default_content', 'insert_default_content');

    This works well when adding a new post via the admin area.
    However, when using the acf_form front-end form to add a post, this default content is not being inserted into the content area of my post. All other content is being added.

    Any ideas as to why not and how I can add this default content to my ACF posts?

  • The content field on the front end uses an ACF WYSIWYG field and not the standard WP field.

    You might be about to alter the default value using an acf/prepare_field function… but this is only a guess and not tested, so I don’t know all of the details.

    add_filter('acf/prepare_field/name=_post_content', 'set_acf_form_default_content');
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.