Custom delete option button in plugin settings

I managed to add delete button this way, it also may be used to add any extra submit button. Create a submit button with name and array attribute: function mw_options_wc_order_attachement_1() { ?> <input type=”file” name=”mw_options_wc_order_attachement_1″ id=”mw_options_wc_order_attachement_1″ value=”<?php echo get_option(‘mw_options_wc_order_attachement_1’); ?>” /> <?php echo get_option(“mw_options_wc_order_attachement_1″); ?> <input type=”submit” name=”submit[delete_attachment_1]” class=”button button-primary” value=”Delete” /> <?php } Register … Read more

How to add values to media “whitelist_options” in wp-admin/options.php template?

firstly, don’t edit core files of WordPress or your changes will be erased at the next update. in the file options.php look below this array declaration, you have this line : $whitelist_options = apply_filters( ‘whitelist_options’, $whitelist_options ); that means that you can custom this array with this code in a plugin or the theme : … Read more

Adding Default Settings to Theme My Login plugin

The data wasn’t fully unserialized and properly made as a multidimensional array wp_parse_args() used unnecessarily. get_option() used unnecessarily. function nls_tml_default_settings() { $nlstml = array( ‘enable_css’ => 1, ‘login_type’ => ‘default’, ‘active_modules’ => array( ‘custom-passwords/custom-passwords.php’, ‘custom-user-links/custom-user-links.php’, ‘recaptcha/recaptcha.php’, ‘security/security.php’, ‘themed-profiles/themed-profiles.php’, ‘user-moderation/user-moderation.php’, ), ‘version’ => ‘6.4.10’, ); update_option( ‘theme_my_login’, $nlstml ); $nlsrecap = array( ‘public_key’ => ‘sitekey’, ‘private_key’ … Read more

How to store a value on WP_option table

replace your code with as. <?php function myplugin_register_settings() { add_option(‘marker_pin’,”); register_setting( ‘marker_group’, ‘marker_pin’, ‘myplugin_callback’ ); } add_action( ‘admin_init’, ‘myplugin_register_settings’ ); function myplugin_register_options_page() { add_options_page(‘Google Map’, ‘Map’, ‘manage_options’, ‘Google_map’, ‘myplugin_options_page’); } add_action(‘admin_menu’, ‘myplugin_register_options_page’); function plugin_admin_enqueue_styles() { wp_enqueue_script( ‘google-maps’, ‘https://maps.googleapis.com/maps/api/js?key=AIzaSyBPUcMLet39Rn_MXvOJErCbT7VnsOAVPWc&libraries=places&callback=initMap’, array(‘jquery’),’1.0′, true ); wp_enqueue_script( ‘ajax-js’, ‘https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js’, array(‘jquery’),’1.0′, true ); wp_enqueue_script( ‘code-js’, ‘https://code.jquery.com/jquery-1.11.3.min.js’, array(‘jquery’),’1.0′, true ); } add_action( … Read more

WordPress options page not saving

You need to pay attention to $page parameter, if its not same anywhere it will not work. <?php add_settings_field( $id, $title, $callback, $page, $section, $args ); ?> $page (string) (required) The menu page on which to display this field. Should match $menu_slug from add_theme_page() or from do_settings_sections(). https://codex.wordpress.org/Function_Reference/add_settings_field <?php add_settings_section( $id, $title, $callback, $page ); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)