Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $wpquery = new WP_Query('post_type=myposts');
- if( $wpquery->have_posts() ) {
- while ($wpquery->have_posts()) : $wpquery->the_post();
- $id = get_the_ID();
- //just a test to see can I get post IDs and I get them
- echo $id; ?>
- <a href="<?php echo get_delete_post_link($id); ?>">Delete</a>
- <?php endwhile; }
- wp_reset_query();?>
- <a href="">Delete</a>
- if ( !$post = get_post( $id ) )
- return;
- $post_type_object = get_post_type_object( $post->post_type );
- if ( !$post_type_object )
- return;
- if ( !current_user_can( $post_type_object->cap->delete_post, $post->ID ) )
- return;
- if ( !$post = get_post( $id ) ) {
- echo 'could not get post. ';
- } else {
- echo 'got post. ';
- }
- $post_type_object = get_post_type_object( $post->post_type );
- if ( !$post_type_object ){
- echo 'could not get post object. ';
- } else {
- echo 'got post object. ';
- }
- if ( !current_user_can( $post_type_object->cap->delete_post, $post->ID ) ){
- echo 'user does not have proper capability. ';
- } else {
- echo 'user is ok to delete this post. ';
- }
- if ( !current_user_can( $post_type_object->cap->delete_post, $post->ID ) )
- return;
Add Comment
Please, Sign In to add comment