Custom form not showing in correct place on page

When working with shortcode you must return a value rather than output directly. The below amendmetn should fix your positioning issue. For more informaiont, see the Shortcode API Codex, speciffically the Output section. function multipage_form() { global $wpdb; $this_page = $_SERVER[‘REQUEST_URI’]; $page = $_POST[‘page’]; if ( $page == NULL ) { /** * first name … Read more

Settings API Message Error is global

The setting that is the first parameter is the not the option key. It is the key that you would’ve registered using register_setting register_setting( ‘settings_unique_key4172_91h, ‘option_key’, ‘name_of_sanitiser_function’ ); Then you can add settings errors like this, inside the callback function name_of_sanitiser_function(){ add_settings_error( ‘settings_unique_key4172_91h’, esc_attr( ‘settings_updated’ ), $message, $type ); } You might like a few … Read more

Customizing $product->get_title() function

In WooCommerce, the product variants are children of the actual product. So perhaps just check if the $product_id you’re on is a child, and if so get the title of the parent. Untested code: // Check if product has parent if($product->post_parent){ $parents = get_post_ancestors( $product->ID ); /* Get the top Level page->ID count base 1, … Read more

Do rewrites added with add_rewrite_rule() persist after plugin deletion?

Let me say beforehand that when using add_rewrite_rule() nothing is written to the htaccess file. Rewrite rules are stored in the database and handled by WordPress internally on PHP level. TL;DR: Rewrite rules do persist after plugin deletion, but probably not the way you’d expect it. When using add_rewrite_rule these rules are added in the … Read more

Conditional custom redirect

It should not be tough. As you suggested you can use ACF to add a custom field in post/page and then use the template_redirect action hook to check if the current page’s custom field is a valid URL as well as $_GET[‘redirect’] is true, wp_redirect to that URL. function my_page_template_redirect() { if( is_url(GET_ACF_FIELD_VALUE( ‘CUSTOM_FIELD’ )) … Read more