WordPress: update_option, don’t update empty options?

More importantly, you should not let *untrusted, unsanitized $_POST data* into WordPress. But I think the issue is that you’re updating the option with the entire $_POST data, instead of the appropriate array key: update_option(‘eirepanel_inline_ads_options’, $_POST); Should probably be something like: update_option(‘eirepanel_inline_ads_options’, $_POST[‘eirepanel_inline_ads_options_name’]); Are your Plugin options discrete (one DB entry per option), or an … Read more

How Can I setup WP CLI on Windows development machine running AMPPS?

Installing wp-cli through Composer is the way to go. For instance: $ cd C:\ $ composer create-project wp-cli/wp-cli –no-dev Copy the path to the bin directory inside the wp-cli directory (something along the lines of C:\wp-cli\bin) Add copied path to the Windows Path variable (tutorial) Exit all CMD’s (or git bash) and reopen them. Now … Read more

Plugin child folder?

You don’t, for the same reason you don’t modify WordPress Core, you extend it or use hooks and filters to modify its behaviour. So when extending or changing plugins you have 2 options: Forking You’ve been creating forks of a plugin so far, but it’s important to change the name when this happens so your … Read more

woocommerce_before_calculate_totals in woocommerce 3.0

Well, the problem is you are calling price directly at $value[‘data’]->price. Make it $value[‘data’]->get_price() and I think you problem will be fixed. So the whole code block will be- function calculate_embossing_fee( $cart_object ) { if( !WC()->session->__isset( “reload_checkout” )) { /* Gift wrap price */ $additionalPrice = 5; foreach ( $cart_object->cart_contents as $key => $value ) … Read more

What hook should be used to programmatically create a post only when master post is updated?

you can use pre_post_update action hook like so: add_action(‘pre_post_update’,’post_updating_callback’); function post_updating_callback($post_id){ global $post; // verify if this is an auto save routine. // If it is our form has not been submitted, so we dont want to do anything if ( defined( ‘DOING_AUTOSAVE’ ) && DOING_AUTOSAVE ) return; if ($post->post_status == “publish”){ //do update stuff … Read more

How to disable updates in WordPress theme

First of all, it is a very bad idea to modify the original theme without creating a child theme. Disabling updates of such theme is even worse idea, because without updates, your site may get infected or attacked. So the long-term solution would be to: Check the version of modified theme. Download that version from … Read more

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