update_option in javascript

JavaScript $(window).scroll(function () { if ($(window).scrollTop() >= $(document).height() – $(window).height() – 10) { /***update options***/ $.ajax({ type: ‘POST’, url: ‘http://www.example.com/wp-admin/admin-ajax.php’, data: { action : ‘hit-bottom’, option : $option, // your option variable new_value : $new_value // your new value variable }, dataType: ‘json’ }).done(function( json ) { alert( “Ajax call succeeded, let’s see what the … Read more

Creating a one click demo importer

I believe that if you are not going to do a massive sql insert (which I think is likely just as efficient) that you need to go ahead and utilize the plugin api and at the time of the button being pressed, create them. I think it’s pretty clear your choice is either to create … Read more

How to set CORS header?

Fixed it by adding Header set Access-Control-Allow-Origin “*” in apache2.conf: <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted Header set Access-Control-Allow-Origin “*” </Directory>

Cannot update WordPress General Settings Site Title and Tagline

Can you check your wp-config.php and double check that you are using the correct database, as if you have changed the values within the wp_options table then they should definitely be reflected in the settings in the back-end of WordPress, whereas, updating from WordPress might not have been saving etc. Sounds like a strange issue … Read more

Deploy pre-configured database

WP-CFM is probably the closest to what you’re looking for. Actually, it has been inspired by Drupal’s Features module. From the plugin page: WP-CFM lets you copy database configuration to / from the filesystem. Easily deploy configuration changes without needing to copy the entire database. However, as someone who has spent the better part of … Read more

How do I output a database option that is an array into a get_posts array?

You could use wp_parse_id_list() to sanitize your comma seperated list of post IDs. It’s defined as: function wp_parse_id_list( $list ) { if ( !is_array($list) ) $list = preg_split(‘/[\s,]+/’, $list); return array_unique(array_map(‘absint’, $list)); } where we can see that it returns unique array values as well. Note that absint() is defined in core as abs( intval() … Read more

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