Skip to content

Instantly share code, notes, and snippets.

@hivepress
Created February 13, 2025 17:21
Show Gist options
  • Select an option

  • Save hivepress/bb5c7a281ebee8cbd94c540122e4211a to your computer and use it in GitHub Desktop.

Select an option

Save hivepress/bb5c7a281ebee8cbd94c540122e4211a to your computer and use it in GitHub Desktop.

Revisions

  1. hivepress created this gist Feb 13, 2025.
    25 changes: 25 additions & 0 deletions functions.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    <?php
    add_filter(
    'hivepress/v1/forms/request_update/errors',
    function( $errors, $form ) {
    $request = $form->get_model();

    if ( $request && ! $request->get_images__id() ) {
    $errors[] = 'Please upload at least one image.';
    }

    return $errors;
    },
    100,
    2
    );

    add_filter(
    'hivepress/v1/forms/request_update',
    function( $form ) {
    $form['fields']['images']['statuses']['optional'] = null;

    return $form;
    },
    1000
    );