Skip to content

Instantly share code, notes, and snippets.

View papazetis's full-sized avatar

Nick Papazetis papazetis

View GitHub Profile
@papazetis
papazetis / at-a-glance.php
Last active February 1, 2021 18:12
Add Custom Post Types to "At a Glance"
<?php
/**
* Add custom post types count action to WP Dashboard (At a Glance)
*/
function add_cpt_glance_items( $items ) {
$args = array(
'public' => true, // Showing public post types only
'_builtin' => false // Except the build-in wp post types (page, post, attachments)
);
@papazetis
papazetis / postname_redirect.php
Last active July 23, 2019 17:49
Redirect only posts to a new subfolder
function postname_redirect() {
// If this is not a 404 page, do nothing.
if ( ! is_404() ) {
return FALSE;
}
// If the current permalink structure is '/%postname%/'.
// Don't do anything, even if we find a 404.
global $wp_rewrite;