Skip to content

Instantly share code, notes, and snippets.

@fredrikwoll
fredrikwoll / aux-functions.php
Last active Feb 18, 2020 — forked from eduwass/aux-functions.php
Programmatically duplicating a WordPress post
View aux-functions.php
<?php
/**
* Duplicates a post & its meta and it returns the new duplicated Post ID
* @param [int] $post_id The Post you want to clone
* @return [int] The duplicated Post ID
*/
function duplicate($post_id) {
$title = get_the_title($post_id);
$oldpost = get_post($post_id);
@fredrikwoll
fredrikwoll / snipet.php
Last active Aug 29, 2015 — forked from qutek/snipet.php
Add Custom Media Upload Worpress
View snipet.php
/*************************
* Enqueue Media Uploader
*************************/
function enqueue_admin_scripts() {
if(function_exists('wp_enqueue_media')) {
wp_enqueue_media();
}
else {
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');