Multiple plugins linked to same settings page

Perhaps you could create a dedicated settings plugin, which you would use to add single settings page and register separate section and setting for each token/url/etc. As the settings are saved to the database you can get them with get_option( ‘setting_name’ ) in any other plugin whenever you need.

Assign value to custom checkbox using get_option()

You can use the checked function for this. https://codex.wordpress.org/Function_Reference/checked The value attribute just indicates the value to be saved if the box is checked. eg. <input type=”checkbox” class=”custom-control-input” name=”my-option” id=”customSwitch1″ value=”1″ <?php checked( ‘1’, get_option(‘my-option’), true ); ?>>

Writing Mysql and Php code in wordpress Posts

With a stock WordPress install, you cannot insert server side code like PHP directly into a post, only HTML-compatible text. Using the [code][/code] shortcode only outputs what is inside as PRE and CODE elements of HTML, useful for showing code to your readers. In general, it is a bad idea to put code directly into … Read more

settings api and the data passed in the parameter

You sanitization callback function get passed all the values that correspond with the setting name. When a POST request is made to the options.php file from the page on which your settings resides, WordPress calls your sanitization callback in a way that would resemble this: <?php boj_myplugin_validate_options( $_POST[‘boj_myplugin_options’] ); Notice that the name attribute looks … Read more

WordPress settings API VS Table In Database?

You should use Custom Post Types. No extra table, no missuse of Settings API. Use CPTs with Title field, WYSIWYG/textarea (for caption) & a featured image (for the actual slider image). This way later themes can also make use of it. Just name the CPT “slider”. Here´s a read why sliders & carousels are not … Read more

Verify Submitted Form Values and Show Warning Messages with Setting API

First add a validation callback to your register_settings: register_setting( ‘settingsapi_optiongroupname’, ‘settingsapi_optionname’,’validation_callback’); then define validation_callback: function validation_callback($input){ //check if all is good //If so then return the wanted value to be saved //If Not then hook your admin notice function and return null to be saved ex: if ($something){ return $input; }else{ add_settings_error(‘unique_identifyer’,esc_attr(‘settings_updated’),__(‘Settings saved.’),’updated’); add_action(‘admin_notices’, ‘print_errors’); … Read more

How to handle complex data with Settings API

When you call register_setting, the third parameter is the sanitize callback function. You can do whatever data manipulation you need in that function, in order to arrange the user input into the format you need for your code. So after the data validation (integers are integers, sanitize text fields, etc.), you can retrieve the current … Read more

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