Skip to content

Instantly share code, notes, and snippets.

View B1-0S's full-sized avatar

Dimitar Radev B1-0S

View GitHub Profile
/*
* Function for post duplication. Dups appear as drafts. User is redirected to the edit screen
* Does not work for CPT!
*/
function rd_duplicate_post_as_draft(){
global $wpdb;
if (! ( isset( $_GET['post']) || isset( $_POST['post']) || ( isset($_REQUEST['action']) && 'rd_duplicate_post_as_draft' == $_REQUEST['action'] ) ) ) {
wp_die('No post to duplicate has been supplied!');
}
@B1-0S
B1-0S / make_slug.php
Created November 15, 2015 22:20 — forked from meSingh/make_slug.php
Create WordPress like slugs from any string in php.
<?php
/**
*
* Genrate Slugs from Title or any given string
*
* @param string $str
* @return Slug
*
**/