Plugin Directory

Changeset 2724113


Ignore:
Timestamp:
05/15/2022 02:09:03 PM (4 years ago)
Author:
ujjavaljani
Message:

Version compatibility Check and minor improvement.

Location:
copy-move-posts/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • copy-move-posts/trunk/copy-move-posts-admin-page.php

    r2380329 r2724113  
    55    }
    66    jQuery(document).ready(function ($) {
    7         //alert("helo");
    87        $("#convert_post").submit(function () {
    98            var isnum = /^\d+$/;
     
    4948        <?php $post_type=apply_filters('CPMV_get_posts_types',''); //echo "<pre>"; print_r($post_type);?>
    5049        <select name="post_from">
    51             <?php foreach ($post_type as $types) {
    52                 if($types->name!='attachment' && $types->name!='revision' && $types->name!='nav_menu_item' && $types->name!='custom_css' && $types->name!='customize_changeset' && $types->name!='oembed_cache' && $types->name!='user_request' && $types->name!='wp_block') {?>
     50            <?php foreach ($post_type as $types) { ?>
    5351                <option value="<?php echo $types->name;?>"><?php echo $types->labels->name?> (<?php echo $types->name;?>)</option>
    54             <?php } }?>
     52            <?php }?>
    5553        </select>
    5654        <span><b>To:</b></span>
    5755        <select name="post_to">
    58             <?php foreach ($post_type as $types) {
    59                 if($types->name!='attachment' && $types->name!='revision' && $types->name!='nav_menu_item' && $types->name!='custom_css' && $types->name!='customize_changeset' && $types->name!='oembed_cache' && $types->name!='user_request' && $types->name!='wp_block') {?>
     56            <?php foreach ($post_type as $types) { ?>
    6057                <option value="<?php echo $types->name;?>"><?php echo $types->labels->name?> (<?php echo $types->name;?>)</option>
    61             <?php } }?>
     58            <?php }?>
    6259        </select>
    6360        </div><br>
  • copy-move-posts/trunk/copy-move-posts-function.php

    r2380329 r2724113  
    33Plugin Name: Copy Move posts
    44Author: Ujjaval Jani
    5 Version: 1.5
     5Version: 1.6
    66Description: You can Copy or Move posts from one Post type to another Post type with custom field,thumbnail and meta information.
    77License: GPLv3
     
    1515function CPMV_get_posts_types()
    1616{
    17     $post_types=get_post_types('','');
     17    $get_cpt_args = array(
     18        'public'   => true,
     19    );
     20    $post_types=get_post_types($get_cpt_args,'object');
     21    unset($post_types['attachment']);
    1822    return $post_types;
    1923}
     
    4044            $pagination=-1;
    4145        }
    42         if(filter_var($_POST['cmp'], FILTER_SANITIZE_STRING)==1)
     46        if(filter_var($_POST['cmp'], FILTER_SANITIZE_STRING)==1) ///Copy posts
    4347        {   
    4448            global $wpdb;
     
    7882                    //print_r($my_post);
    7983                    //exit();
    80                     $post_id=wp_insert_post( $my_post , $wp_error);
     84                    $post_id=wp_insert_post( $my_post , true); 
    8185                }
    8286                else
     
    9195                        'post_type'             => filter_var($_POST['post_to'],FILTER_SANITIZE_STRING),
    9296                    );
    93                     $post_id=wp_insert_post( $my_post , $wp_error);
     97                    $post_id=wp_insert_post( $my_post , true); 
    9498
    9599                    foreach ($post_meta as $key => $value) {
     
    100104            }
    101105        }
    102         elseif(filter_var($_POST['cmp'], FILTER_SANITIZE_STRING)==2)
    103         {   
     106        elseif(filter_var($_POST['cmp'], FILTER_SANITIZE_STRING)==2) ///Move posts
     107        {
    104108            global $wpdb;
    105109            $args = array('post_type'=> filter_var($_POST['post_from'],FILTER_SANITIZE_STRING),'posts_per_page'=> filter_var($pagination,FILTER_SANITIZE_STRING));
     
    114118                        'post_type'             => filter_var($_POST['post_to'],FILTER_SANITIZE_STRING),
    115119                    );
    116                     $post_id=wp_update_post( $my_post , $wp_error);
     120                    $post_id=wp_update_post( $my_post , true); 
    117121            }
    118122
     
    121125}
    122126add_action('init', 'CPMV_convert_post');
    123 
    124 
    125 ?>
  • copy-move-posts/trunk/readme.txt

    r2380329 r2724113  
    11=== Copy Move Posts ===
    22Contributors: ujjavaljani
    3 Tags: Copy posts,Move posts,posts Meta data,posts Thumbnails,posts custom fields,downloads,custom posts,copy move posts,bulk copy,bulk move, duplicate posts, move posts, transfer posts
     3Tags: Copy posts, Move posts, posts Meta data,posts Thumbnails,posts custom fields,downloads,custom posts,copy move posts,bulk copy,bulk move, duplicate posts, move posts, transfer posts
    44Requires at least: 3.9
    5 Tested up to: 5.5.1
    6 Stable tag: 1.5
     5Tested up to: 5.9.3
     6Stable tag: 1.6
    77License: GPLv3
    88
     
    3939
    4040== Changelog ==
     41= 1.6 - 15/05/22 =
     42* Check WordPress version compatibility.
     43* New - Custom post type listing changes, only showinf public posts.
    4144= 1.5 - 13/09/20 =
    4245* Check WordPress version compatibility.
Note: See TracChangeset for help on using the changeset viewer.