Action Hook: rwmb_before

Support General Action Hook: rwmb_before

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #35375
    Kyle B.Kyle B.
    Participant

    TL;DR: The 'Default Value' field for the WYSIWYG editor does not work and I need a solution to prefill it. Tried 'rwmb_before' and can't find any solution in the docs.

    How do I correctly use this hook? I read the documentation but I am obviously missing something.

    The 'default value' field for the WYSIWYG element is no use, as it is a text field so I am trying to pre-fill the WYSWIG field using the "rwmb_before" hook, but the documentation is limited and does not explain how to get the data from the metabox, and the hook for targetting a specific ID does not appear to work.

    The custom field ID: 'district_tax_area_override_content'

    1. I have tried the hooks 'rwmb_before_district_tax_area_override_content', 'rwmb_before_{district_tax_area_override_content}', neither work.
    2. I have tried 'rwmb_before' which is firing, but I do not know how to get any of the data from the object. No documentation on it that I can find.
    3. I would really like to target the 1 metabox, not have to use 'rwmb_before' to index every metabox until it lands on the one I need. Even then, I need to know how to access the data of the object.

    #35386
    Long NguyenLong Nguyen
    Moderator

    Hi Kyle,

    As I can see the setting default value std is working as well for the field wysiwyg if you use the code to set the HTML as the default value.

    [
        'name'       => __( 'Wysiwyg', 'your-text-domain' ),
        'id'         => $prefix . 'wysiwyg_ugp9gornk7111',
        'type'       => 'wysiwyg',
        'std'        => '<span class="test-123">Test default value</span>',
    ],

    If you want to modify the field settings by coding, please use the filter rwmb_normalize_{$field_id}_field
    Refer to this topic https://support.metabox.io/topic/image-upload-vs-image-advanced/#post-33927

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