Noptin_Custom_Field_Action::run( Noptin_Subscriber $subscriber, Noptin_Automation_Rule $rule, array $args )

Update a subscriber’s custom field.

Parameters Parameters


(Noptin_Subscriber) (Required) The subscriber.


(Noptin_Automation_Rule) (Required) The automation rule used to trigger the action.


(array) (Required) Extra arguments passed to the action.

Top ↑

Return Return


Top ↑

Source Source

File: includes/automation-rules/actions/class-noptin-custom-field-action.php

    public function run( $subscriber, $rule, $args ) {

        $settings = $rule->action_settings;

        // Nothing to do here.
        if ( empty( $settings['field_name'] ) ) {

        $field_name  = esc_html( $settings['field_name'] );
        if ( empty( $settings['field_value'] ) ) {
            return delete_noptin_subscriber_meta( $subscriber->id, $field_name );

        $field_value = esc_html( $settings['field_value'] );

        return update_noptin_subscriber_meta( $subscriber->id, $field_name, $field_value );


Top ↑

Changelog Changelog


Top ↑

User Contributed Notes User Contributed Notes

30 day money back guarantee
Safe & Secure online payment
Custom CSS Slide Example
Custom Animation Example
Default Animation