Support

Account

Home Forums Bug Reports Required ACF field not preventing post Scheduling (+errant Publish)

Unread

Required ACF field not preventing post Scheduling (+errant Publish)

  • We’re on WPEngine @ WP 6.1.1 using Advanced Custom Fields PRO 5.12.2

    We have a “Required Field” called Section that, in certain scenarios, is not being required before publishing. In fact, under a certain flow when the intention is to Schedule… the post is becoming Published immediately with at least 2 munged fields.

    That “worst case” scenario flow seems to be:

    1. When the date is moved forward (field missing)
    2. Then the autosave functionality kicks in (triggering a Draft)
    3. Then the user clicks Schedule, then Schedule again (triggering an immediate Publish)
    4. The Add New Post UI seems to indicate the Scheduling has been prevented, but it hasn’t

    We’ve captured a video of the above:

    “Demonstrate Required ACF Field Failure as related to Scheduled Posts (+Errant Publish Behavior)”

    https://www.loom.com/share/428cb6b5bf9b48938390b89fc2677078

    If anyone has any ideas on direction to take from here, we’d be grateful to hear them before escalating to a ticket.

    Thank you,
    Michael

    PS The “best case” scenario where it fails, on rare occasions, is using a Publish + Publish flow. However, reproducing that has proved difficult as it generally “works as expected”… until it doesn’t. Because the UI errors / prompts and Post State are very consistent, and the missing field seems like something an Author would most likely correct during flow prior to an errant publish… we’re considering it “low risk” at this moment. (versus the above “worst case” scenario where the behavior and result differs greatly from the expectation)

    —— VIDEO SCRIPT BEGIN

    – First, we search for our test tag in All Posts
    – We open a fresh Add New Post tab
    – We add our tagged Post Title
    – We fill in 2 fields required for our tests
    – First, a Hero Image
    – Then Chapter which we set to “BU TEST”
    – Here we’re skipping over the required Section field, leaving it blank
    – We change the Publish Date to add 7 days
    – We add TEXT to the Block to trigger a Post State Update (without clicking Save in Progress)
    – We search our test tag again to confirm Post Status
    – We can see here that the Post has been saved as Draft
    – It has a Section set to Culture when none was selected
    – It has a Chapter set to National when “BU TEST” was selected
    – We move back to the Add New Post tab and click Schedule, pause for 5 seconds, then click the final Schedule Button
    – We do receive a required field notice
    – Before we do anything else, we add TEXT to the Block to trigger a Post State Update
    – We search our test tag again to confirm Post Status
    – We see despite scheduling this 7 days out…
    1. The Post has flipped immediately to Published
    2. The Post has Published with the incorrect Section
    3. The Post has Published with the incorrect Chapter
    – We go back and we hide the schedule menu, then scroll down we can see the more informative ACF Field Error Message for the required Section field, but it obviously hasn’t prevented saving as draft or posting of the content which is now Published despite the intention to Schedule

    —— VIDEO SCRIPT END

    —— ACF FIELD JSON BEGIN

    {
        "key": "group_REDACTED_ID",
        "title": "Article Information",
        "fields": [
            {
                "key": "field_REDACTED_ID",
                "label": "Section",
                "name": "section",
                "type": "taxonomy",
                "instructions": "You may only select one section or subsection for a post.",
                "required": 1,
                "conditional_logic": 0,
                "wrapper": {
                    "width": "",
                    "class": "",
                    "id": ""
                },
                "taxonomy": "category",
                "field_type": "select",
                "allow_null": 0,
                "add_term": 0,
                "save_terms": 1,
                "load_terms": 1,
                "return_format": "id",
                "multiple": 0
            }
        ]
    }

    —— ACF FIELD JSON END

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.