WordPress Codesnippets

Completely disable comments

				
					
				
			

This code is used to disable comments and trackbacks from WordPress. It redirects any user trying to access the comments page, removes the comments metabox from the dashboard, disables support for comments and trackbacks in post types, and closes comments on the front-end. Additionally, it hides existing comments, removes the comments page from the menu, and removes comments links from the admin bar.

Was this code snippet helpful?
YesNo

Leave a Reply

Your email address will not be published. Required fields are marked *

Programmatically save post

This code creates a WordPress post with the values of the ‘post_title’ and ‘post_content’ variables. It sets the post status to ‘publish’ and the author

Read More »

Create order programmatically

This code creates a new post in the WordPress database with post type ‘shop_order’, post title ‘Order #12345’, post status ‘wc-processing’, and ping status ‘closed’.

Read More »