
How to Get the Current Page Slug in WordPress (PHP)
To get the current page slug in WordPress with PHP, use get_post_field( ‘post_name’, get_the_ID() ). WordPress stores the slug as post_name in the database,
Andy has been a full time WordPress developer for over 15 years. Through his years of experience has built 100s of sites and learned plenty of tricks along the way.
Found this article helpful? Buy Me A Coffee
102 posts published

To get the current page slug in WordPress with PHP, use get_post_field( ‘post_name’, get_the_ID() ). WordPress stores the slug as post_name in the database,

If you’ve uploaded a high-resolution image to your WordPress site and noticed the filename now ends in -scaled.jpg, you’ve met WordPress’s large image scaling

Everyone knows how annoying a CAPTCHA can be but they are essential at cutting down spam on your WordPress site. From contact forms to
Avatars add a personal touch to comments, author bios, and user profiles in WordPress. Whether you’re building a theme or adding custom functionality, here’s

To get the current page or post title in WordPress with PHP, use get_the_title(). It returns the title as a string and works with

The fastest way to see the word count of any post or page in WordPress: click the document overview icon (the small lines icon

Your PHP version affects your site’s speed, security, and plugin compatibility. Outdated PHP versions no longer receive security patches, which makes your site vulnerable.

To get the current page URL in WordPress with PHP, combine the global $wp object with home_url(). This works on any page type (posts,

The best WordPress social image generators in 2026 automatically create branded Open Graph and Twitter card images for every post on your site, no

WordPress doesn’t have a one-click “duplicate” button built into the post list, so copying a page or post takes a few extra steps. Whether

If you’ve ever shared a link on social media you are well aware of the preview image that is shown. These photos attached as

The meta_query parameter in WP_Query lets you filter WordPress posts by their custom field values. If you use Advanced Custom Fields or store data

At its core plugins are essential to having a great WordPress experience. It can be difficult to find good WordPress plugins but we have

Add a Last Login column to your WordPress user list with a free plugin or custom code snippet. Both methods explained step by step.

If you’ve tested your website’s speed on tools like Google PageSpeed Insights or GTmetrix you may have seen the message “Eliminate render-blocking resources”. When

Removing the “Proudly powered by WordPress” line from your site’s footer takes about 30 seconds on a modern block theme and a few more

If you’ve ever tried to upload a large PDF, video, or image to WordPress and seen “file exceeds the maximum upload size for this

Are you having problems with your WordPress memory limit? One common issue that can plague a WordPress site is the dreaded “PHP Fatal error:

Google Analytics has been the default for website tracking for over a decade, but it comes with trade-offs: heavy scripts, complex dashboards, and privacy

The fastest way to add dark mode to your WordPress site is to install the free WP Dark Mode plugin: it adds a toggle

The fastest WordPress accordion plugin for most sites is Lightweight Accordion (no JavaScript, pure HTML details/summary). For sites that need more styling and animation,

Ever since WordPress 5.5 you can now have your plugins and themes auto-update. This is a great feature to keep your site up to

Bots are constantly trying to log in to your WordPress site. This can cause lots of server load and, more importantly, could lead to

Planning on leaving Squarespace for WordPress? Here’s how to migrate all of your Squarespace content to a self-hosted WordPress site. Squarespace can be great