Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function property_update_shortcode() {
- ob_start(); ?>
- <form method="post">
- <input name="property_value" />
- <input type="hidden" name="action" value="update_property">
- <input type="submit">
- </form>
- <?php
- return ob_get_clean();
- }
- add_shortcode( 'property_update', 'property_update_shortcode' );
- function save_property_data() {
- if( isset( $_POST['action'] ) && $_POST['action'] == 'property_update' ) {
- global $post;
- update_post_meta( $post->ID, 'property_value', $_POST['property_value'] );
- wp_fusion()->user->push_user_meta( get_current_user_id(), array( 'property_value' => $_POST['property_value'] ) );
- }
- }
- add_action( 'init', 'save_property_data' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement