Plugin setting page – update_option problem

Your chunk of code if (isset($_POST[‘submit’])) { would process all the form submissions (even other forms which is not your settings page) which is why you are lossing your data. Even though this is not good way to create option page. But If you do something like if(is_admin() && isset($_POST[‘submit’]) && isset($_POST[‘ffita_gads_capub’])){…. could solve your … Read more

How to save the option’s new values plus old value without overwrite old one

You are misspelling the variables names. You define them as $new_value and $old_value with underscore that you forgot about. Except this your code working fine. function myplugin_update_field_foo( $new_value, $old_value ) { if ($new_value !== $old_value && is_array($old_value) && is_array($new_value)) { $new_value = array_unique( array_merge( $new_value, $old_value ) ); } return $new_value; } To get the … Read more

Problem with checkbox in Settings API

I managed to figure this out. It was because on the template page where I output the form I had forgotten to include the settings_fields function, so it was not saving the setting. I added the following code below to that page and then it worked: <?php settings_fields(‘prev-next-setting’); ?>

Integrating colorpicker into array field

Real quick this should point you in the right direction, you need to define your colorpicker and then reference it, so like: switch( $arguments[‘type’] ){ case ‘text’: case ‘password’: case ‘number’: printf( ‘<input name=”%1$s” id=”%1$s” type=”%2$s” placeholder=”%3$s” value=”%4$s” />’, $arguments[‘uid’], $arguments[‘type’], $arguments[‘placeholder’], $value ); break; case ‘colorpicker’: printf( ‘<input name=”%1$s” id=”%1$s” type=”%2$s” placeholder=”%3$s” value=”%4$s” />’, … Read more

Display shortcode in text field with wordpress settings api

Use a shortcode with parameters function oosdfw_title_display($atts) { $a = shortcode_atts( array( ‘before’ => ‘Sorry, ‘, ‘after’ => ‘ has sold out.’, ), $atts ); return $a[‘before’].get_the_title().$a[‘after’]; } add_shortcode( ‘oosd-title’, ‘oosdfw_title_display’ ); Put shortcode in text field and modify before and after parameters to suit your requirements. [oosd-title before=”Sorry ” after = ” has sold … Read more

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