Show readers an automatic “5 min read” message based on the amount of text in a blog post. Steps Add the code below to your theme’s functions.php. Save the changes. Open a blog post. The estimated reading time will appear before the post content.
If you often forget to set a featured image, you can automatically use the first image inside the post content as the featured image. Steps Add the code below to your theme’s functions.php. Publish or update a post that contains an image. If the post does not already have a featured image, WordPress will use […]
XML-RPC is a WordPress feature that allows external applications to communicate with your website. When you do not use XML-RPC functionality, you can disable it with a simple filter. Steps Add the code below to your theme’s functions.php. Save the changes. WordPress will disable XML-RPC methods that depend on the xmlrpc_enabled setting.
You can automatically redirect users to a custom page after they successfully log in to your WordPress website. This is useful when you want users to land on a dashboard, account page, or another specific section instead of the default WordPress location. Steps Add the code below to your theme’s functions.php. Change the destination URL. […]
Customize the default footer text shown at the bottom of the WordPress admin dashboard. This is useful for adding your company name, support information, or a custom message. Steps Add the code below to your theme’s functions.php. Replace the text with your own message. Save the file. Open any WordPress admin page and scroll to […]
For SEO, blindly redirecting every 404 to the homepage isn’t always recommended. A custom 404 page is often better.
Output: echo esc_url( mytheme_get_current_url() );
Automatically adds the current WordPress post type as a CSS class to the `<body>` element using the `body_class` filter. This is useful when working with custom post types and custom themes, allowing developers to target specific post types with CSS or JavaScript without adding classes manually to templates. For example, a custom post type named […]