Force Post Author Comments to Moderation in WordPress

By default in WordPress when an author of a post comments on their own posting the comment is automatically approved. This makes sense when authors are associated with the site, have access to admin, etc.

There are cases where content from the general public is used to create posts and while the user is logged in and set as the author it’s still responsible to moderate their comments.

The below snipppet checks to see if the user id found in $commentdata has permissions to moderate comments. If not, we force to moderation, if so, we approve it.