Send Custom Post Notification to Followers
Send Custom Post Notification to Followers
Send Custom Post Notification to Followers
My page won’t publish
Wrap it in a function and hook it to transition_post_status: function wpse_18140_transition_post_status( $new, $old, $post ) { if ( $new === ‘publish’ && $new !== $old ) { // Your code here } } add_action( ‘transition_post_status’, ‘wpse_18140_transition_post_status’, 10, 3 ); This will run everytime a post is published, but not when you simply update the … Read more
How can I get taxonomy terms and custom field values of a newly created post
I ended up going with this type of solution. It seems to be working fine for me. I am open on ways to improve this code as it seems there is a better hook that could be used. function on_music_publish( $post_ID, $post ) { if ( $post->post_type != ‘music’ ) { return; } update_post_meta($post_ID, ‘_disable_fbc’, … Read more
Try this: <div class=”my-metabox”> <!– This is your metabox HTML –> <– Add this button somewhere: –> <button id=”my-submit” class=”button button-primary button-large”>Submit</button> </div> Add this JavaScript snippet however you want only to this screen (either by checking the post type and enqueue this in the admin footer or output it directly along with your metabox … Read more
get_the_modified_author(); isn’t going to tell you who published the post, just who last edited it. You will need to capture you publisher yourself. function post_published_notification( $ID, $post ) { $publisher = wp_get_current_user(); update_post_meta($ID,’my_publisher’,$publisher); } add_action( ‘publish_post’, ‘post_published_notification’, 10, 2 ); Then use get_post_meta($post_id,’my_publisher’) to retrieve the data. Of course there are a numerous ways to … Read more
The hook you choose is important here. I found success choosing the latest hook I could wp_insert_post. If other functions are hooked to the same action they need to be considered because if they create/update posts too these hooks will be called again. The codex lists the Post, Page, Attachment, and Category Actions (Admin) in … Read more
Here is the description of transition_post_status from the codex: This function’s access is marked as private. That means it is not intended for use by plugin and theme developers, but only in other core functions. It is listed here for completeness. Use any of these functions instead. Why not use the publish_post action instead? There … Read more
MainWP does not use iframes to publish posts it uses the “newpost” function for the Dashboard to send the new post to your child site. You can see the newpost function in action with these GitHub searches: newpost on Dashboard newpost on Child If you need custom processes built you can check the MainWP Codex … Read more