public function saveFields($term_id)
    {
        // No term or no fields
        if (!isset($term_id) || empty($term_id) || empty($this->fields)) {
            return;
        }

        // Check slug
        $slug = Request::post('taxonomy', '');

        // Check integrity
        if (empty($slug) || $slug !== $this->slug) {
            return;
        }

        // Remove action hook and add it again later for no infinite loop
        remove_action('created_'.$slug, [&$this, 'saveFields']);
        remove_action('edited_'.$slug, [&$this, 'saveFields']);

        /**
         * Fires for all term's fields.
         *
         * @var string $slug
         * @param int $term_id
         * @param array $fields
         */
        do_action('ol_zeus_termhook_save_'.$slug, $term_id, $this->fields);

        // Update all metas
        foreach ($this->fields as $field) {
            if (!$field) {
                continue;
            }

            // Build contents
            $ctn = (array) $field->getModel()->getContents();
            $hasId = (boolean) $field->getModel()->getHasId();

            // Check ID
            if ($hasId && (!isset($ctn['id']) || empty($ctn['id']))) {
                continue;
            }

            // Gets the value
            $value = Request::post($ctn['id'], null);

            // Check value
            if (is_null($value)) {
                $value = Option::getTermMeta($term_id, $slug.'-'.$ctn['id']);
            }

            /**
             * Filter the value content.
             *
             * @var string $current
             * @param int $term_id
             * @param string $option_name
             * @param object $value
             * @return object $value
             */
            $value = apply_filters('ol_zeus_termhook_save_'.$slug.'_field', $value, $term_id, $slug.'-'.$ctn['id']);

            // Updates meta
            Option::updateTermMeta($term_id, $slug.'-'.$ctn['id'], $value);
        }

        // Add back action hook again for no infinite loop
        add_action('created_'.$slug, [$this, 'saveFields'], 10, 2);
        add_action('edited_'.$slug, [$this, 'saveFields'], 10, 2);

        return true;
    }
public function saveFields($term_id)
    {
        // No term or no fields
        if (!isset($term_id) || empty($term_id) || empty($this->fields)) {
            return;
        }

        // Check slug
        $slug = Request::post('taxonomy', '');

        // Check integrity
        if (empty($slug) || $slug !== $this->slug) {
            return;
        }

        // Remove action hook and add it again later for no infinite loop
        remove_action('created_'.$slug, [&$this, 'saveFields']);
        remove_action('edited_'.$slug, [&$this, 'saveFields']);

        /**
         * Fires for all term's fields.
         *
         * @var string $slug
         * @param int $term_id
         * @param array $fields
         */
        do_action('ol_zeus_termhook_save_'.$slug, $term_id, $this->fields);

        // Update all metas
        foreach ($this->fields as $field) {
            if (!$field) {
                continue;
            }

            // Build contents
            $ctn = (array) $field->getModel()->getContents();
            $hasId = (boolean) $field->getModel()->getHasId();

            // Check ID
            if ($hasId && (!isset($ctn['id']) || empty($ctn['id']))) {
                continue;
            }

            // Gets the value
            $value = Request::post($ctn['id'], null);

            // Check value
            if (is_null($value)) {
                $value = Option::getTermMeta($term_id, $slug.'-'.$ctn['id']);
            }

            /**
             * Filter the value content.
             *
             * @var string $current
             * @param int $term_id
             * @param string $option_name
             * @param object $value
             * @return object $value
             */
            $value = apply_filters('ol_zeus_termhook_save_'.$slug.'_field', $value, $term_id, $slug.'-'.$ctn['id']);

            // Updates meta
            Option::updateTermMeta($term_id, $slug.'-'.$ctn['id'], $value);
        }

        // Add back action hook again for no infinite loop
        add_action('created_'.$slug, [$this, 'saveFields'], 10, 2);
        add_action('edited_'.$slug, [$this, 'saveFields'], 10, 2);

        return true;
    }
public function saveFields ( $ term_id ) { // No term or no fields if ( ! isset ( $ term_id ) || empty ( $ term_id ) || empty ( $ this -> fields ) ) { return ; } // Check slug $ slug = Request :: post ( 'taxonomy' , '' ) ; // Check integrity if ( empty ( $ slug ) || $ slug !== $ this -> slug ) { return ; } // Remove action hook and add it again later for no infinite loop remove_action ( 'created_' . $ slug , [ & $ this , 'saveFields' ] ) ; remove_action ( 'edited_' . $ slug , [ & $ this , 'saveFields' ] ) ; /**
         * Fires for all term's fields.
         *
         * @var string $slug
         * @param int $term_id
         * @param array $fields
         */ do_action ( 'ol_zeus_termhook_save_' . $ slug , $ term_id , $ this -> fields ) ; // Update all metas foreach ( $ this -> fields as $ field ) { if ( ! $ field ) { continue ; } // Build contents $ ctn = ( array ) $ field -> getModel ( ) -> getContents ( ) ; $ hasId = ( boolean ) $ field -> getModel ( ) -> getHasId ( ) ; // Check ID if ( $ hasId && ( ! isset ( $ ctn [ 'id' ] ) || empty ( $ ctn [ 'id' ] ) ) ) { continue ; } // Gets the value $ value = Request :: post ( $ ctn [ 'id' ] , null ) ; // Check value if ( is_null ( $ value ) ) { $ value = Option :: getTermMeta ( $ term_id , $ slug . '-' . $ ctn [ 'id' ] ) ; } /**
             * Filter the value content.
             *
             * @var string $current
             * @param int $term_id
             * @param string $option_name
             * @param object $value
             * @return object $value
             */ $ value = apply_filters ( 'ol_zeus_termhook_save_' . $ slug . '_field' , $ value , $ term_id , $ slug . '-' . $ ctn [ 'id' ] ) ; // Updates meta Option :: updateTermMeta ( $ term_id , $ slug . '-' . $ ctn [ 'id' ] , $ value ) ; } // Add back action hook again for no infinite loop add_action ( 'created_' . $ slug , [ $ this , 'saveFields' ] , 10 , 2 ) ; add_action ( 'edited_' . $ slug , [ $ this , 'saveFields' ] , 10 , 2 ) ; return true ; }
Hook building custom fields for Post types.

@param number $term_id
@return number|void
Hook building custom fields for Post types .