This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Hide entire site unless logged in. | |
* | |
* Gist Keywords: wordpress, privacy | |
* Author: Knol Aust | |
* Version: 1.0.0 | |
* Description: This function hides all WordPress content from users who are not logged in. Visitors will see a custom message instead of any pages or posts, except for the login page. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Customize WordPress Login Logo. | |
* | |
* This code replaces the default WordPress logo on the login page with a custom logo. | |
* Update the URL to your custom logo and adjust the width and height accordingly. | |
* | |
* Gist Keywords: wordpress, admin, login | |
* | |
* @category WordPress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Modify External Links to Open in New Tab. | |
* | |
* This code modifies external links within the post content to open in a new tab | |
* and adds the "noopener noreferrer" attributes for security. | |
* | |
* Gist Keywords: wordpress, customization | |
* | |
* @category WordPress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add Duplicate Button to Post/Page List of Actions in WordPress Admin. | |
* | |
* This code adds a "Duplicate" button to the list of actions for posts and pages | |
* in the WordPress admin, allowing users to quickly duplicate a post or page. | |
* | |
* Gist Keywords: wordpress, duplicate, posts, pages, functionality | |
* | |
* @category WordPress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove jQuery Migrate dependency from jQuery in the frontend. | |
* | |
* This function removes the jQuery Migrate script dependency from the jQuery script | |
* when loading scripts in the frontend to improve performance. | |
* | |
* Gist Keywords: wordpress, jquery, javascript, performance | |
* | |
* @category WordPress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Redirect attachments to their parent posts or homepage. | |
* | |
* This function checks if the current page is an attachment and if it has a parent post. | |
* If the attachment has a parent post that is not trashed, it redirects to the parent post. | |
* If the attachment has no parent or the parent post is trashed, it redirects to the homepage. | |
* | |
* Gist Keywords: wordpress, disable attachment, pages | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Customizes the WordPress admin bar greeting text. | |
* | |
* This function replaces the default "Howdy," text in the WordPress admin bar with a custom greeting text. | |
* | |
* Usage: | |
* - Edit the value of the `$new_howdy` variable to set the desired greeting text. | |
* | |
* @param WP_Admin_Bar $wp_admin_bar The WordPress admin bar object. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Adds a custom class to the body tag in WordPress based on post type and name. | |
* | |
* This function modifies the classes applied to the body tag of a WordPress page. | |
* It adds a class that combines the post type and the post's slug (name). | |
* This can be useful for applying specific CSS styles to different pages or posts. | |
* | |
* Gist Keywords: wordpress, functions, body, css, styles | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Removes the WordPress version number from the HTML generator tag. | |
* | |
* This function attaches to the 'the_generator' filter hook and replaces the | |
* default WordPress generator string with an empty string. This is often used | |
* for security purposes to obscure the WordPress version number. | |
* | |
* @link https://developer.wordpress.org/reference/hooks/the_generator/ WordPress Hook: the_generator | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Disables the Gutenberg editor for editing posts. | |
* | |
* This snippet attaches to both 'gutenberg_can_edit_post' and | |
* 'use_block_editor_for_post' hooks to disable the Gutenberg editor, | |
* reverting to the classic WordPress editor. The priority is set to 5 | |
* to ensure this runs early enough to override any default settings. | |
* | |
* Gist Keywords: wordpress, editor, gutenberg, classic |
NewerOlder