Category Archive: WordPress
Posts about WordPress
Quick code snippet showing basic use of the WordPress template_redirect action hook. This is provided as a quick copy/paste reference for WordPress developers. This hook is useful for customizing any functionality requiring full query information.
Most good themes include a screenshot, primarily to be displayed on the Themes screen in the WP Admin Area. Of course, theme screenshots can be displayed anywhere, even on the frontend.
I’m surprised that WordPress doesn’t provide a function for getting the site creation date. Knowing when the site was set up can be useful for all sorts of things. Copyright dates. Bragging rights. Whatever. If you want to display the date your site was first installed, here is one way to do it.
Normally the “Screen Options” tab is an awesome little WordPress feature. Located on various screens in the WP Admin Area, the Screen Options tab toggles open any available settings. Like which meta boxes to display, layout columns, editor auto-height, and other options depending on which screen you are viewing. But there may be cases where […]
WordPress makes it easy to get the current user’s role(s) by using wp_get_current_user(). But what if you want to get all roles from all users. Like a list of every role that is used on your site. Well good news, WordPress provides a global object named $wp_roles that provides the information. So if you’re looking […]
Here is a function used in my free WordPress plugin User Submitted Posts that enables you to rename WordPress media uploads. So for example, if the user uploads a JPG image named “sweet-ride.jpg”, the following function will append a random string to rename the file “sweet-ride-random.jpg”, where “random” is a random alphanumeric string containing 20 […]
Working on my plugin Disable Gutenberg, I needed a way to get the ID of an edited post. Not on the front-end, but on the “Edit Post” screen in the WP Admin Area. Unfortunately WordPress does not provide a built-in core function for handling this, so it’s necessary to roll our own solution.
In WordPress, you can create posts, pages, or any custom post type. Within your theme template, you can get the current post type using the core WP function, get_post_type(). But that doesn’t work in the Admin Area. For example, my Disable Gutenberg plugin provides conditional functionality to the “Add New” and “Edit” screens based on […]
There are a million contact form plugins, but this one is MINE. One of the primary communication channels for my online empire is the Perishable Press Contact Page. I get a TON of email from that location, all coming from different projects, plugins, books, tutorials, etc. So the contact form that I display must be […]
Quick post to announce my latest WordPress security plugins, Banhammer (free version) and Banhammer Pro. These plugins give you full control over site access, enabling you to warn or ban any user or bot with a click. So you can monitor traffic via slick Ajax UI, and drop the Banhammer on any suspicious or threatening […]
After months of hard work, I am stoked to announce the launch of my new video course on WordPress Plugin Development. It covers the entire process of building, securing, and optimizing your own plugins, including 50+ ready-to-go plugin demos and examples.
Here is a good, WP-API method of limiting post display to the currently logged-in post author (i.e., so users can only view their own posts). Here you’ll find two variations of this technique. The first limits the display of posts for non-admin users only. The other limits the display of posts for all users, including […]