Comments and pingbacks issues

Actually, after trying a lot more I figured out that it was actually something quite simple I just forgot. Apart from the code in the comment.php, you also have to change this in your single.php: <?php comments_template(); ?> to <?php comments_template(”, true); ?> And that did the trick! I leave this here for future reference … Read more

counting trackbacks, pingbacks and comments of a post

I think you can use get_comments. In the type parameter you can pass the type of comment (trackback, ping), you can filter by status, and you have a parameter called count, that when is set to true returns just the number of comments that match the parameters you passed. get_comments( array( ‘status’ => ‘approve’, ‘post_id’=> … Read more

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

Disable comments and pingbacks on old custom post types

Let’s make it easier. I want to disable comments and pingbacks everywhere in all single posts, custom post types and pages both new and old. You could remove comment support for your post types. remove_post_type_support( ‘posttype’, ‘comments’ ); // for each of your post types of course The same can be done when registering the … 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

Delay the ping to Google when publishing new Posts or Pages

The pingback functions run via the hoook do_pings. The core use the follow default: add_action( ‘do_pings’, ‘do_all_pings’, 10, 1 ); This hook is on default a cron job, running in the scheduling as single event of the core. I think you should remove this hook via remove_action and add a custom logic to fire this … 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

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