How to change the post author when the post is published?

From the code you have posted there, it doesn’t look like, at any time, you’re are hooking the function on to save_post outside of your function. function change_pos_auth($post_id){ if ( ! wp_is_post_revision( $post_id ) ){ // unhook this function so it doesn’t loop infinitely remove_action(‘save_post’,’change_pos_auth’); if ( isset($_GET[‘auth_id’]) ) { $args = array(‘ID’=>$post_id,’post_author’=>$_GET[‘auth_id’]); // update … Read more

How to get latest page (not post) of User and display the content

You need to use WP_Query. get_posts will only get you post =) <?php $user_id = get_current_user_id(); echo $user_id; $args=array( ‘post_type’ => ‘page’, ‘post_status’ => ‘published’, ‘posts_per_page’ => 1, ‘author’ => $user_id ); $wp_query = new WP_Query($args); while ( have_posts() ) : the_post(); the_title(); endwhile; ?> Tested, and it is working

Automatically Populate Post Taxonomy Data Based on Post Author Meta Data?

Figured it out for anyone who wants to know: function update_school( $post_id ) { $post_author_id = get_post_field( ‘post_author’, $post_id ); // get the post author ID $school_name = get_the_author_meta( ‘school2’, $post_author_id ); // from the post author ID, get the author meta $term = term_exists( $school_name, ‘school’); wp_set_post_terms( $post_id, $term, ‘school’ ); } // run … Read more

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