Support Forum » User Profile

Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • in reply to: Remote Validation Example? #22960
    Mitchell ValkMitchell Valk
    Participant

    Thanks for the response, the thing I'm trying to do is check if a post exists already that has 1 or 2 exact values. So to be more specific, I'm adding a chapter, and a chapter can have a chapter_number and chapter_part meta, so I'm already checking if the chapter_number is unique, but if chapter_part is also set, it needs to look for a post that has both metas set and if it exists, return false.

    So far all my attempts to get the data of 2 fields in one remote validation have not worked.

    in reply to: Remote Validation Example? #22934
    Mitchell ValkMitchell Valk
    Participant

    For other people trying to initially find out how the remote function works, since I had some issue finding this out initially, here's some sample code.

    'validation' => array(
        'rules' => array(
            'field_id' => array(
                'remote' => admin_url( 'admin-ajax.php?action={action_name}' ),
            ),
        ),
    ),
    add_action( 'wp_ajax_{action_name}', 'remote_validation' );
    
    function remote_validation() {
        echo wp_json_encode( 'true' );
        return true;
    }
    Mitchell ValkMitchell Valk
    Participant

    As long as this doesn't bloat the Metabox core, I'm all for it.

    in reply to: Can not connect to packages.metabox.io #22931
    Mitchell ValkMitchell Valk
    Participant

    Did you add them to your repositories in your composer.json? It is not really clear in the explanation, but it is a requirement for using the connection.

    "repositories": [
            {
                "type": "composer",
                "url": "https://packages.metabox.io/{your key}"
            },
            {
                "type": "composer",
                "url": "https://wpackagist.org"
            }
        ],
Viewing 4 posts - 1 through 4 (of 4 total)