how to show new field if option selected?
how to show new field if option selected?
how to show new field if option selected?
I suspect wp-includes/option.php is not being loaded in your environment. You must have the whole WordPress environment loaded to use get_option(). So e.g. per include_once ‘wp-load.php’;
It was a 👼 character. Make sure you sanitize everything that gets written as field values, even if it’s a username. trim(preg_replace(“/[^\w\s]+/”, “”, $user->full_name)) I assumed there are no special characters in Instagram usernames. Never assume. I don’t really use Instagram, just my plugin supports it. BTW it got truncated on the first occurrence of … Read more
If you are developing the theme for yourself to use I don’t see any reason for adding options if you don’t want to/know how. If you are planning on distributing/selling your theme though, you might want to consider adding some options for your customers to change the settings and customize the theme. I’d say that … Read more
Seems like $name_value dump is 10 characters long although Michelle is only 8 characters long. Try adding trim( $name_value ) to selected function.
$value[‘postal_codes’] is not an array it is a string, you either need to explode it like: foreach ( $myoptions as $key => $value ) { if (in_array($p,explode(“,”$value[‘postal_codes’]){ // need to know $key of which array the $p was found, in this case I would like to find [0] } } Or search on the string … Read more
You can use register_activation_hook(). Add this to your plugin, tested and works. register_activation_hook(__FILE__, ‘redirect_after_activation’); function redirect_after_activation() { add_option(‘redirect_after_activation_option’, true); } add_action(‘admin_init’, ‘activation_redirect’); function activation_redirect() { if (get_option(‘redirect_after_activation_option’, false)) { delete_option(‘redirect_after_activation_option’); exit(wp_redirect(admin_url( ‘wp-admin/admin.php?page=axl_ads’ ))); } }
@Buttered_Toast’s solutions is what you are looking for, if you were in a position to use it. There are a bunch of problems with your code. Variables $confused_about_treatment_editor, $estimated_price_editor, and $satisfaction_guarantee_editor are never instantiated. The values of $option_name and $option_valueare changed three times, but only the last value is ever used. There is no closing … Read more
Your options are saved under a single key my_option_name, so you would access the individual options like: $my_options = get_option( ‘my_option_name’ ); echo $my_options[‘title’]; echo $my_options[‘id_number’];
you have to make a javascript code similar to this… jQuery(function ($) { name = $(‘#name’).val(); $(‘#name’).data(‘old_value’,name); window.onbeforeunload = function () { if ($(‘#name’).data(‘old_value’) !== $(‘#name’).val()) return ‘You have unsaved changes!’; } }); here’s a demo page… try closing the page after changing the value of the textbox there…