WordPress custom options storing?

WordPress is built to import and export content. As such, there is no built-in way to import or export settings. Some theme and plugin authors, however, have built tools into their systems that import/export XML files that their systems can use store options. A great example is WordPress SEO by Yoast. Not only can you … Read more

Removing \\\ from Saved Data

You can change the ” signs to " automatically using PHP’s htmlspecialchars() prior to your update_option() call: $post_client_template = htmlspecialchars( $post_client_template ); update_option( ‘contact_record_client_template’, $post_client_template); If you need to change ‘ characters as well, use this: $post_client_template = htmlspecialchars( $post_client_template, ENT_QUOTES ); update_option( ‘contact_record_client_template’, $post_client_template);

How can I get my options in json response?

You shouldn’t save your theme’s options one by one. In that case, you should call each of them separately, or store them in an array and then run a loop to get their values: $options = array( ‘option1’, ‘option2’, ‘option3’); foreach( $options as $option ){ // The rest of your code } But the proper … Read more

Put standard wordpress options into a theme options panel?

An easier approach would be to leave the options-general.php sub menu unblocked and define: define(‘WP_HOME’,’http://example.com’); define(‘WP_SITEURL’,’http://example.com’); in your wp-config.php. When the siteurl and homeurl are defined in wp-config.php the options are grayed out on the options page. This would allow your client to change the site title, description, time zone and registration settings.

Disable image resizing on specific upload fields

WordPress will always create the additional images for “thumbnail”, “medium” and “large” sizes. The options panel doesn’t add an additional size- it just resizes the one you’ve selected using CSS. If you want to override that CSS you can hook in an additional stylesheet that will override the id on that option.

How can I insert some extra validation into the theme options’ validation function using add_filter?

You want to manipulate and return the same input you have coming into the function. In your case that is $input. That is how filters work. function add_validation( $input ) { // here I want to add some validation for a simple field named ‘example’ if ( isset( $input[‘example’] ) && !empty( $input[‘example’] ) ) … Read more

How to create dependent field in Customizer?

You can get and check the value of your theme mod as you normally do anywhere. This code is tested and working (the code inside cyb_customizer() is exactly the code you posted in the question, only added add_section part): function flag_is_custom_excerpt_enabled(){ $blueplanet_options = get_theme_mod( ‘blueplanet_options’); if( empty( $blueplanet_options[‘theme_enable_custom_excerpt’] ) ) { return false; } return … Read more

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