Posts Tagged "add_action"

How to use hooks (actions and filters) in wordpress and woocommerce

What are hooks? Hooks are helpful in WordPress which allow you to manipulate code without editing core files. It is used extensively used throughout WordPress and WooCommerce by developers. Two types of hook: actions and filters. Action Hooks allow you to insert custom code. Filter Hooks allow you to manipulate and return a variable. There are lot of excellent article on hooks and filters as follows: 1) 2) 3)–wp-27373 4) Using hooks If you use a…

Read More

How to disable posts auto save in WordPress?

WordPress have a very useful function that auto-saves your posts while you’re typing them in the dashboard. Though, if for some reason you’d like to disable this function, it is very easy to do. Just read on! To disable WordPress autosaving function, simply open your functions.php file and paste the following function: function disableAutoSave(){ wp_deregister_script(‘autosave’); } add_action(‘wp_print_scripts’, ‘disableAutoSave’); That’s all. Once you saved the file, WordPress will never autosave a post. To enable autosaving again, simply delete this code. Shashi…

Read More