Tag Info

Hot answers tagged

6

There is no special hook to author change. But you can achieve it by using post_updated hook. Example: add_action('post_updated', 'prefix_on_update_author', 10, 3); function prefix_on_update_author($post_ID, $post_after, $post_before) { if ($post_after->post_author != $post_before->post_author) { // author has been changed // ...


1

As often the case, asking the question reveals the answer: Use global $authordata;. Fix php errors: == operator. Fix $rid='445', not $rid=445. Here's the working code: add_action ('genesis_before_sidebar_widget_area','user_testimonials',10); function user_testimonials(){ if (is_author() || is_singular('post')){ global $authordata; //using global ...


1

I am not sure what approach you are using to send ajax request, but if you are using WordPress standard code for Ajax requests. Source: https://codex.wordpress.org/AJAX_in_Plugins There are two issues with your current code. 1) You are echoing inside the loop, don't do it, concat all the author html inside loop, and once loop ends only than echo it. 2) ...


1

Give this a try 1) First add new headers for the plugin meta: add_filter('extra_plugin_headers', 'add_extra_headers'); function add_extra_headers(){ return array('Author2'); } 2) Next filter the authors meta row on output: add_filter('plugin_row_meta', 'filter_authors_row_meta', 1, 4); function filter_authors_row_meta($plugin_meta, $plugin_file, ...


1

Use pre_get_posts to modify author archive queries- function wpd_author_archive( $query ){ if ( $query->is_author() && $query->is_main_query() ){ $query->set( 'post_type', array( 'post', 'product' ) ); } } add_action( 'pre_get_posts', 'wpd_author_archive' );



Only top voted, non community-wiki answers of a minimum length are eligible