apply_filters field meta not working

Support MB Frontend Submission apply_filters field meta not workingResolved

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #44977
    Nicholas CoxNicholas Cox
    Participant

    Hi

    I am using the following code, but it is not working in my functions file. The value is not updating and i receive no errors.

    apply_filters( 'rwmb_myfieldtest_field_meta', 'test');

    thanks

    #44986
    PeterPeter
    Moderator

    Hello,

    You should use the function add_filter() to hook your callback function to that filter hook. Please follow the documentation https://developer.wordpress.org/reference/functions/add_filter/

    I remember you have an example in one of previous topics
    https://support.metabox.io/topic/rwmb-field-meta-filter-for-cloneable-groups/

    #44996
    Nicholas CoxNicholas Cox
    Participant

    Hi, yes i am aware that I need a add_filter, but when i call apply_filters it doesnt affect the output when i pass in the parameter of 'test'. When i error_log this test in PHP i can see that the 'test' string is being called after metabox has ran.

    #45012
    PeterPeter
    Moderator

    Because the apply_filters is added in the Meta Box source code. You need to use add_filter to add the callback function on your side.

    #45186
    Nicholas CoxNicholas Cox
    Participant

    ok thanks

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.