Guest User

Untitled

a guest
Aug 21st, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. /**
  2. * Stop Jetpack Publicize sharing posts from the frontend job submit form entries
  3. *
  4. * @param $new_status
  5. * @param $old_status
  6. * @param $post
  7. */
  8. function prefix_flag_post_for_publicize( $new_status, $old_status, $post ) {
  9.  
  10. // Make sure the job_manager_form is set, it is the job_listing post type and the post status is publish
  11. if ( ! isset( $_POST['job_manager_form'] ) || $post->post_type != 'job_listing' || $new_status != 'publish' ) {
  12. return;
  13. }
  14.  
  15. // If it is the submit-job form on the frontend, set the jetpack filter to return false
  16. if ( $_POST['job_manager_form'] == 'submit-job' ) {
  17. add_filter( 'publicize_should_publicize_published_post', '__return_false' );
  18. }
  19.  
  20. }
  21. // Set the priority to 9 so it runs before the Jetpack version
  22. add_action( 'transition_post_status', 'prefix_flag_post_for_publicize' , 9, 3 );
Add Comment
Please, Sign In to add comment