Sunday, October 9, 2022
HomeWordPress Developmentsubmit meta - Save frontend submission type discipline as customized discipline

submit meta – Save frontend submission type discipline as customized discipline


I exploit plugin for submitting posts from frontend. It is a discipline builder.
Possibly it makes use of wp_insert_post() perform, I actually do not know.

Right here I exploit my customized shortcode, please examine right here for the code:

perform my_custom_shortcode() {
    world $wpdb;
    $outcomes = $wpdb->get_results( "SELECT metropolis FROM slovak_cities" );
    
    $choose="<choose identify="city_field">";
    $choose .= '<possibility worth="-1">- choose your metropolis -</possibility>';
    
    foreach ( $outcomes as $consequence ) {
        $choose .= '<possibility worth="' . str_replace( ' ', '_', strtolower( remove_accents( $result->metropolis ) ) ) . '">' . $result->metropolis . '</possibility>';
    }
    
    $choose .= '</choose>';
    
    return $choose;
}
add_shortcode( 'my_shortcode', 'my_custom_shortcode' );

This shortcode creates a dropdown discipline in submit type with many many choices. All choices inside are generated from database.
This all the pieces is OK and works good.

However I need assistance with saving this discipline as customized discipline to submit when submit type is submitted. The factor has a reputation attribute named “city_field”. This worth must be a META KEY of customized discipline and META VALUE must be one chosen possibility from factor.

Can somebody assist me please? I do know that that is associated to add_post_meta() or update_post_meta() capabilities, however the way to use them? Are there any motion or filter hooks out there?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments