Skip to content

Instantly share code, notes, and snippets.

@zorzv
zorzv / cpt-to-cpt.php
Created August 17, 2021 12:13 — forked from HarishChaudhari/cpt-to-cpt.php
Copy posts from one Custom Post Type to another. (It doesn't handle post attachments for now)
<?php
add_action('admin_init', 'foo_duplicate_posts', 99999);
function foo_duplicate_posts(){
// Only allow admins to run the script
if(!current_user_can('manage_options'))
return;
// Check if keyword is set
if(!isset($_GET['duplicate-posts']))
@zorzv
zorzv / ld-auto-mark-complete.php
Created August 17, 2021 12:26 — forked from weismannweb/ld-auto-mark-complete.php
Auto complete learndash topics and lessons
//thanks to https://gist.github.com/sultann/24baa5483b4632c3cf214a8de5648204#file-ld-auto-mark-complete-php-L17 for most of
//this code, i just corrected it to work with ld_lesson_tag to grab the tags as the original version returned empty
//array since it was looking for standard wp tags
function ld_is_tagged($postId) {
//get all learndash tags on post
$tags = wp_get_post_terms($postId,'ld_lesson_tag');
foreach ($tags as $tag) {
//need to check for auto-mark-complete tag exists on this post