add_settings_section() order

You can adjust the priority of dr_issue_settings_init() so that it fires after the default of 10. This should make it appear after the existing settings on the same settings page. function dr_issue_settings_init() { add_settings_section( ‘dr_issue_section’, //$id __( ‘Issue settings’ ), //title ‘dr_issue_section_callback’, //callback ‘mytheme_settings’ // page ); } add_action( ‘admin_init’, ‘dr_issue_settings_init’, 100 );

Adding settings link to plugin doesn’t work

The code is working and tested. Activate your plugin you will see the settings link add_filter( ‘plugin_action_links_’ . plugin_basename(__FILE__), ‘apd_settings_link’ ); function apd_settings_link( array $links ) { $url = get_admin_url() . “options-general.php?page=my-plugin”; $settings_link = ‘<a href=”‘ . $url . ‘”>’ . __(‘Settings’, ‘textdomain’) . ‘</a>’; $links[] = $settings_link; return $links; }

Preserve old values on error in setting API

Unfortunately WordPress does not provide the old value as an additional argument to your sanitize_callback callable. This is supported in general by the option validator hook that WordPress calls when saving the updated setting… return apply_filters( “sanitize_option_{$option}”, $value, $option, $original_value ); …but in practice it is not actually registered with any additional arguments when the … Read more

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

Display Each Setting Section In Each Specific Tab within Same Page || Settings API

Incase anyone stumbles across this, I recently encountered the same issue and was able to render the differnet using do_setting_fields( $page, $section ) instead of do_settings_sections( $page ). As per the settings api, do_settings_sections prints out all settings sections added to a particular settings page, whilst do_settings_fields prints out the settings fields for a particular … Read more

Error: options page not found when I try to save the changes made in my settings page

The problem is in my file settings.php (which renders the form). Look at the form action. It says action=”options.php” and then the settings_field() inserts a hidden field with the correct action. But WordPress prioritizes the form action, so, when submit the form, WordPress tries to load options.php instead of the correct action in the hidden … Read more

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