WooCommerce add_action hook results in 500 error

Remove the = sign after your echo statement… echo = “<p>Text Goes Here</p>”; …becomes echo “<p>Text Goes Here</p>”; Final add_action( ‘woocommerce_review_order_after_shipping’, ‘action_woocommerce_review_order_after_shipping’); function action_woocommerce_review_order_after_shipping( ) { echo “<p>Text Goes Here</p>”; }

Which hook is fired when inserting media into a post

The add_attachment action is fired when the wp_insert_attachment() function is called to add an item to the media library. Images are added to posts after going into the media library first. Even when adding via the post editor, items are added to the library with wp_insert_attachment() then to the post. add_action( ‘add_attachment’, function( $post_ID ) … Read more

How to get list of all hooks of current theme / plugin?

As of 2016-09-25, there is no ideal solution. The WP-Parser does the job, but you need to set up a special WP site to run it. WooCommerce’s Hook-docs is something much simpler, and can be easily tweaked. I just wrote a long comment on the topic here: https://github.com/ApiGen/ApiGen/issues/307#issuecomment-249349187

How to register custom post types in a plugin?

The init hook is the first hook allowed. If called earlier it won’t work. See WP Codex: https://developer.wordpress.org/plugins/post-types/registering-custom-post-types/ Create or modify a post type. register_post_type should only be invoked through the ‘init’ action. It will not work if called before ‘init’, and aspects of the newly created or modified post type will work incorrectly if … Read more

Is there a recover_post hook to go with trash_post hook?

Looking at the code for WP 3.3.2, it seems that trash_post is actually wp_trash_post. From the wp_trash_post() function in /wp-includes/post.php: do_action(‘wp_trash_post’, $post_id); add_post_meta($post_id,’_wp_trash_meta_status’, $post[‘post_status’]); add_post_meta($post_id,’_wp_trash_meta_time’, time()); $post[‘post_status’] = ‘trash’; wp_insert_post($post); wp_trash_post_comments($post_id); do_action(‘trashed_post’, $post_id); So … I’d double check the hook you’re using to set your initial flag. However, there is a hook you can use … Read more

Creating a function that receives the taxonomy terms that have been changed in a custom post type

After WordPress has updated a posts’ taxonomy terms it triggers the action: set_object_terms (see source) which passes 6 variables: Object ID Terms that were assigned to the post (or added depending on 5) (could be their slug or term ID). Taxonomy-term IDs of above (not term IDs) The taxonomy Append. If true – terms in … Read more

How can I filter blog name?

The value is from get_option(‘blogname’), so you can filter pre_option_blogname: add_filter( ‘pre_option_blogname’, ‘wpse_78345_blogname’ ); function wpse_78345_blogname() { return ‘Haha!’; } Do not filter option_blogname. This is wrong: you are wasting time with that, because WordPress will parse the option cache for the stored result, and then you don’t even use it.

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