Custom Fields
Re-Envisioned
Support General rwmb_normalize_meta_box Filter not present in code but is present in docs

This topic contains 2 replies, has 2 voices, and was last updated by  Content Pilot 4 months, 3 weeks ago.

  • Creator
    Topic
  • #14652
    Resolved
    Content Pilot
    Participant

    I want to filter the title of the metabox.

    I found this filter, rwmb_normalize_meta_box_id_meta_box, in the documentation but cannot find it within the source code even when I search for rwmb_normalize.

    https://docs.metabox.io/filters/#rwmb_normalize_meta_box_id_meta_box

    Is this filter still available or is the documentation out of date?

    How can I filter the title of a metabox?

    Like this?

    add_filter("rwmb_normalize_{$metabox_id}_meta_box", 'prefix_change_meta_box_title' ), 10, 1 );
    function prefix_change_meta_box_title( $meta_box ) {
        $meta_box['title'] = esc_html__( 'New title', 'text-domain' );
        return $meta_box;
    }
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #14662

    Anh Tran
    Keymaster

    Hi Clayton,

    Sorry, the docs was not updated. This filter was rarely used and was removed from the plugin. To change the meta box title, please use this code:

    add_action( 'init', function() {
        $meta_box = rwmb_get_registry( 'meta_box' )->get( 'your_meta_box_id' );
        $meta_box->meta_box['title'] = 'New title';
    }, 99 );
    #14678

    Content Pilot
    Participant

    Thanks Ahn!

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.