This file contains hidden or 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
// Add a Metabox to List Attachments in the editor - https://snipsnip.pro/s/724 | |
if (!class_exists('AddPostAttachmentsMetaBox')) { | |
class AddPostAttachmentsMetaBox { | |
public function __construct() { | |
add_action('add_meta_boxes', array($this, 'add_metabox_of_post_attachments')); | |
} | |
public function add_metabox_of_post_attachments() { | |
$post_types = get_post_types(array('public' => true), 'names'); | |
foreach ($post_types as $post_type) { |
This file contains hidden or 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
// SimplePostDuplicator - Adds a Duplicate option to Posts & Pages without using a plugin! https://snipsnip.pro/s/701 | |
if (!class_exists('SimplePostDuplicator')) { | |
class SimplePostDuplicator { | |
public function __construct() { | |
add_action('admin_action_simple_post_duplicator_duplicate_post_as_draft', array($this, 'duplicatePostAsDraft')); | |
add_filter('post_row_actions', array($this, 'addDuplicatePostLink'), 10, 2); | |
add_filter('page_row_actions', array($this, 'addDuplicatePostLink'), 10, 2); | |
} |
This file contains hidden or 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
<? // <- remove this line if you copy/paste into Code Snippets Pro | |
/** | |
* SITE: Add Env Notice to Admin Screens | |
* | |
* For admins only, display an admin notice with the current domain environment, such as: [STAGING] or [LOCAL] or [PRODUCTION] | |
* /* Requires Env555 */ | |
*/ | |
/* Requires Env555 */ |
This file contains hidden or 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
<? // <- remove this line if you copy/paste into Code Snippets Pro | |
/** | |
* WP Settings: Set All Themes & Plugins to Auto-Update | |
* | |
* Set all themes and plug-ins to auto update. | |
* * Run only as needed | |
*/ | |
namespace tOrGBs5p; |
This file contains hidden or 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 this line if you copy/paste into Code Snippets Pro | |
/** | |
* Posts: Auto Set First Image as Featured | |
* | |
* Takes the first image attached to a post and sets it as the post's featured image. | |
* | |
* Code from: https://wordpress.stackexchange.com/a/131436 | |
*/ | |
namespace xKceqd2; |
This file contains hidden or 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
<? // <- remove this line if you copy/paste into Code Snippets Pro | |
namespace cpZgLjBJ; | |
function add_metabox_of_post_attachments() | |
{ | |
add_meta_box('att_thumb_display', 'Attachments', '\cpZgLjBJ\generate_list_of_post_attachments', 'post'); // Change your post type here | |
} | |
function generate_list_of_post_attachments($post) | |
{ |
This file contains hidden or 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 | |
// Adapted from: https://www.shibashake.com/wp/add-custom-taxonomy-tags-to-your-wordpress-permalinks | |
namespace Bs3LfBs; | |
function add_custom_tax_permalink($permalink, $post_id, $leavename) { | |
// name of the custom taxonomy | |
$taxName = 'song'; |
This file contains hidden or 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 | |
namespace FyjaHmx9; | |
require_once(ABSPATH.'wp-admin/includes/user.php' ); | |
\FyjaHmx9\create_and_delete_n_new_users(); | |
function create_new_user() { | |
$username = \uniqid(); | |
$userdata = array( |