Custom Fields
Re-Envisioned
Support MB Frontend Submission Set shortcode post_id via functions.php

This topic contains 1 reply, has 2 voices, and was last updated by  Anh Tran 1 year, 5 months ago.

  • Creator
    Topic
  • #8730
    Resolved
    patte
    Participant

    Hey guys,

    since a few hours I’m running in a problem and I hope you can help.

    I’m trying to set the value for the shortcode post_id via functions.php. I’m not setting it via GET parameter in the url and not via attribute in the wysiwyg editor of the post where I have embedded the form.

    So here is my code:

    add_filter( 'rwmb_frontend_field_value_post_id', 'my_custom_population_function', 10, 2 );
    function my_custom_population_function( $value, $args ) {
        if ( $args['id'] === 'car_informations' ) {
            $value = 123;
        }
        return $value;
    }
    $value = apply_filters( "rwmb_frontend_field_value_post_id", $value, $args );

    Maybe an important information. By trying to debug the problem, I’ve tried to print_r the $args array before the if() and it’s empty.

    Do you have any ideas?

    Would be really cool – thank you! 🙂

    Christoph

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.