WordPress Codesnippets

Remove admin bar programmatically


This code adds a filter to the WordPress show_admin_bar function to return false. The purpose of this is to prevent the admin bar from appearing at the top of the site when viewing it as a logged-in user. This can be beneficial for a variety of reasons, such as providing a cleaner user experience or increasing the security of the site.

Was this code snippet helpful?

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 »