Custom Field and edit post page/shortcode hook

Support MB Frontend Submission Custom Field and edit post page/shortcode hookResolved

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

    I have created a Custom Field and have it working successfully but I wanted to know is there a hook where i can customise the output of the value returned from the database? on the post edit screen and shortcode pages?

    e.g. currently the value for my custom field returns 'example.jpg'
    and I want to run a custom JS function to perform a action on this value when a user is viewing the edit post form.

    I need to do this as my custom field expects the existing value to be in a certain format in order for it to be edited.

    Thanks

    #33000
    Long NguyenLong Nguyen
    Moderator

    Hi,

    If you want to add a JS function when editing the post and custom fields, I think no need to customize the output of field value, just hook a function to the action init and check if it's the admin area or edit page on the frontend. Refer to this topic https://support.metabox.io/topic/redirect-only-on-submit-not-an-update/

    Or simply, create a field custom_html and add the <script> tag to the content.
    https://docs.metabox.io/fields/custom-html/

    #33014
    Nicholas CoxNicholas Cox
    Participant

    ok thanks for the detailed explanation. I have had a test and it works great!

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