Advertisement
fauzanjeg

Frontend Submit Tanpa Review

Dec 18th, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. add_filter( 'jnews_frontend_submit_create_post', 'jnews_frontend_post_status_change');
  2. function jnews_frontend_post_status_change($args) {
  3.     if( is_user_logged_in() ) {
  4.         $roles = array( 'author', 'editor' );
  5.         $user  = wp_get_current_user();
  6.         foreach ( $roles as $role ) {
  7.             if ( in_array( $role, $user->roles ) ) {
  8.                 $args['post_status'] = 'publish';
  9.                 return $args;
  10.             }
  11.         }
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement