exclude pingbacks from wordpress SQL query

You can achieve this by excluding pingback from the comment_type column of wordpress comments table $query = “select wp_posts.*, coalesce(( select max(comment_date) from $wpdb->comments wpc where wpc.comment_post_id = wp_posts.id AND comment_approved = 1 AND post_password = ” AND comment_type NOT IN ( ‘pingback’ ) ), wp_posts.post_date ) as mcomment_date from $wpdb->posts wp_posts where post_type=”post” and … Read more

How do I get the trackback count of a post in wordpress without writing an SQL query?

You can specify what kind of comment you want to retrieve using get_comments(). // Assumes you’ve set $post_id somewhere. $args = array( ‘type’ => ‘trackback’, ‘post_id’ => $post_id, ); $trackbacks = get_comments( $args ); $trackback_count = count( $trackbacks ); Edited to add: As Sally CJ points out in the comments, you can do this in … Read more

Notify Jenkins of new post on WordPress

Take a look at some of WordPress’s Actions & Filters – in particular, you might want something like publish_post: function my_custom_post_action( $post_id, $post ) { // Send out data to your service using something // like wp_remote_request: // https://codex.wordpress.org/Function_Reference/wp_remote_post } add_action( ‘publish_post’, ‘my_custom_post_action’, 10, 2 ); You may need to ensure that the post is … Read more

Comments vs. Pingbacks next page issue

Since you’re listing pings separately from comments, you probably need to filter get_comments_number to exclude pings. Here’s how I do it: <?php function oenology_comment_count( $count ) { // Only filter the comments number // in the front-end display if ( // WordPress conditional that returns true if // the current page is in the WP-Admin … Read more