Importing old Disqus comments into WordPress

Without having a sample xml file, it’s impossible to try to debug that plugin and see where it is failing. Tried to search if some innocent soul left a file hanging on the internets, but nope. But one can see what others are saying: The nightmare that is Disqus export, and import into WordPress. September … Read more

Stop WordPress redirecting comment-page-1 to the post page?

Great question! WordPress assigns your comment page number to the query var ‘cpage’ which gets set when your URL has /comment-page-1/ at the end. So your culprit is in the redirect_canonical() function, line 192 of /wp-includes/canoncial.php. if ( get_query_var(‘paged’) || is_feed() || get_query_var(‘cpage’) ) { Since the redirect_canonical() function gets set as an action what … Read more

Removing the “Website” Field from Comments and Replies?

Create a file in wp-content/plugins/ with this code: <?php /* Plugin Name: Get Rid of Comment Websites */ function my_custom_comment_fields( $fields ){ if(isset($fields[‘url’])) unset($fields[‘url’]); return $fields; } add_filter( ‘comment_form_default_fields’, ‘my_custom_comment_fields’ ); Normally, I’d say put it into your theme’s functions.php file, but I wouldn’t recommend doing that for a theme that could update like Twenty … Read more

How do I delete all comments from a specific old blog post?

Alternative for people reading this with a fear for SQL…………… (or finding this via Google after Januari 2011): Wait for this action until 3.1 comes out, then go to a post, check all comments and bulk “move to trash” 🙂 (it should come out any day now) (http://wordpress.org/about/roadmap/) (or download 3.1 RC3 from http://wordpress.org/download/release-archive/) Example: … Read more

Disable comments on all posts/pages

The check if comments are enabled is performed by comments_open() function. You can make it always return false via a filter with something like this: add_filter(‘comments_open’, ‘__return_false’); Other way would be to make comments available to only registered users (that is if you don’t have open registration) in Settings > Discussion.

comment_post_ID 0 (cannot remove from dashboard)

I’m sorry can’t comment here but i’ll try to help. wp_handle_comment_submission function handing comments posting contains exact check for post_id: $post = get_post( $comment_post_ID ); if ( empty( $post->comment_status ) ) { … return error_happened; } i.e. (1) it passes through , or (2) comment was added other than default way of posting comments. For … Read more

Commenting in user profile page?

Hi @Towfiq: Comments are related in the database to Posts. You’ll have to do a lot of work to get Comments to relate to Users. Have you considered creating a Custom Post Type for Users and then use either a user_meta field to store the post_id, or a postmeta field to store the user_id, or … Read more

Approve comment hook?

Just like posts, a comment can have an array of different statuses, so instead of naming a hook with each status, they have transition hooks, which tell you what status it had before and what’s the new status. In your case, this might do the trick: add_action(‘transition_comment_status’, ‘my_approve_comment_callback’, 10, 3); function my_approve_comment_callback($new_status, $old_status, $comment) { … Read more

Non-threaded comment replies with link to original comment

This is my solution and not the proposed solution suggested on the WordPress forums. It turns out to be fairly easy, but involves a few steps. 1) Go to wp-admin->Settings->Discussion and switch off threaded comments. This will disable threading, which we want, but will also remove the ability for us to “reply to” a particular … Read more