Twillio How To Send SMS for Custom Post Type

You should be able to change publish_post to publish_sms then remove any conditional logic. This is due to the following hook: https://developer.wordpress.org/reference/hooks/new_status_post-post_type/ This is a bit of an aside, but I’m making the assumption you’ve defined your post type key as sms (all lowercase) if not then you may need to use publish_SMS but it’s … Read more

Prevent publish status/date saved on transition_post_status hook

I think that hook fires after the post status has been updated. Try this add_action( ‘pre_post_update’, ‘intercept_adherence_publishing’, 10, 2); function intercept_adherence_publishing ($post_ID, $data ) { if (get_post_type($post_ID) !== ‘protocol-adherence’) { return; } $post = get_post($post_ID); $adherence_status = $_POST[‘_adherence_status’]; if ( ( $data[‘post_status’] === ‘publish’ ) && ( $post->post_type == ‘protocol-adherence’ ) && ( $adherence_status !== … Read more

How to hook into the quick edit action?

There are two flaws in the code that I can see. The first one is a bug in this code if($post->post_type != ‘product’) If no post exists, you get the following error Notice: Trying to get property of non-object… This can be fixed by first checking if a post isset if(isset($post) && $post->post_type != ‘product’) … Read more

Is it possible to create an action hook using do_action() within add_action()?

Creating an answer based upon responses via comments on original question of: Is it possible to create an action hook using do_action() within add_action()? Yes it is possible to create an action hook using do_action() on a call to add_action(). For clarification, the following code does NOT work: add_action(‘init’, do_action(‘my-hook-name’)); As stated by @IvanHanák in … Read more

WPMU Hook for archive or deactivate blog?

According to wpseek.com, there exist hooks for unarchive_blog, archive_blog, and deactivate_blog. You can examine them in the source on WordPress’s Trac site: archive_blog unarchive_blog deactivate_blog All of them use the $blog_id parameter. Try changing your function to reflect that: add_action( ‘archive_blog’, ‘wp_clear_cache_custom’ ); function wp_clear_cache_custom( $blog_id ) { wp_cache_clear_cache( $blog_id ); }

Please explain me what the do_action does

If you hook some functions to the before_sidebar action, they will be executed in your code. Your action is now probably without any function hooked, so it returns nothing. Example: <?php add_action( ‘before_sidebar’, function() { echo ‘Try me!’; }); add_action( ‘before_sidebar’, function() { echo ‘Yep. ‘; }, 1); // this should output “Yep. Try me!” … Read more

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