Data sanitization escaping HTML apostrophes

It should add a slash when storing the data. And then you use stripslashes when you want to display it. $str = “Is your name O\’Reilly?”; echo stripslashes($str); // Outputs: Is your name O’Reilly? If a slash is not added, all sorts of unexpected things can happen because the apostrophe can be handled as the … Read more

Is the WordPress HTTPS Plugin Still Safe To Use? [closed]

If you are looking to use HTTPS, I reccomend following this wordpress guide: https://make.wordpress.org/support/user-manual/web-publishing/https-for-wordpress/#implementing-https-for-wordpress You can get a free SSL Certificate from: https://letsencrypt.org/ If you find difficulty setting it up, you can often pay your host a small fee to help set this up. Once set up, you just need to make sure all the … Read more

Generic plugin (de)activation hook?

do_action( ‘deactivate_’ . $plugin, $network_deactivating ); Fires as a specific plugin is being deactivated. do_action( ‘deactivated_plugin’, $plugin, $network_deactivating ); Fires after a plugin is deactivated. The above hooks don’t fire when silent mode is activated (eg: during an update). Refer: deactivated_plugin

How can I show drafts in wp_dropdown_pages list?

Update It seems that you can do this directly with WP function wp_dropdown_pages() as birgire points out in his response below: https://wordpress.stackexchange.com/a/240275/102371 This solution is longer, and uses get_posts() to fetch specific post statuses. $pages = get_posts( array( ‘post_type’ => ‘page’, ‘post_parent’ => 0, ‘post_status’ => array( ‘draft’, ‘publish’ ) ) ); echo ‘<select name=”selected-food-type” … Read more

Intercepting a add_action

You can use has_action(). It returns the priority of the hook if it exists, otherwise false. So check that the priority is not equal to false (and not just false-y, or being hooked at 0 will appear false) then use that to remove the hook. $priority = has_action( ‘publish_post’, ‘myCustomFunction’ ); if ( $priority !== … Read more