Doing action based on input from options menu

You should post to the same URL and catch the submit ex: function option_page_html(){ if (isset($_POST[‘plugin_action’]) && $_POST[‘plugin_action’] == ‘post_url’){ include_once(plugin_dir_path(__FILE__).’post-video.php’); } ?> <div> <form action=”” method=”post”> <p><h3>Paste video url</h3></p> <input type=”text” size=”100″ name=”url” /><br/> <input type=”hidden” name=”plugin_action” value=”post_url”> <input type=”submit” value=”Post”/> </form> </div> <?php } note : this is an example and you should … Read more

Custom Function for SEO by Yoast plugin

What you need is get_post_meta instead of get_post_type This: if ( get_post_type( $post->ID ) == ‘design’ ) { Should be: $meta = get_post_meta($post->ID,’your-meta-key’,true); if (!empty($meta)) { Put altogether function design_canonical_wpse_93717() { global $post; $meta = get_post_meta($post->ID,’your-meta-key’,true); if (!empty($meta)) { return $meta; // assuming this is an absolute URL } } add_filter( ‘wpseo_canonical’, ‘design_canonical_wpse_93717’ ); The … Read more

Multi-part form and wp_redirect()

You have a form like <form action=”http://some/url/form_two.php” method=”POST”> <input type=”whatever” value=”nothing” /> <input type=”hidden” name=”form_one_displayed” value=”1″ /> <input type=”submit” value=”Send” /> </form> in e.g form_one.php In form_two.php you validate the data that was send (or not) <?php $result = do_some_validation_with( $_POST ); if ( false == $result ) wp_redirect( ‘form_one.php’ ); else display_form_two(); function do_some_validation_with( … Read more

Capturing POST data

It points to options.php because it uses the Settings API. Well, not completely, but that’s not the point now. You should not change that. What you can do, to add your own logic: hook into the save process for that option: add_filter( “sanitize_option_webweb-member-status-group”, “your_extra_handler” ); function your_extra_handler( $input ) { if ( isset ( $_POST[‘your_extra_post_field’] … Read more

Fetch the input type date value via ajax

If you want to post the value as soon as user has entered the date and click somewhere else, this might help you: jQuery(‘#your-name’).on(‘blur’, function(){ var date_Value = this.value; var ajaxdata = { action: ‘process_date’, date_value: date_Value }; jQuery.post(ajaxurl, ajaxdata, function(res){ /* whatever you want to do, res contains the output generated by your php … Read more