add_attachment.php
1 month ago
admin_head.php
1 month ago
admin_init.php
1 month ago
admin_menu.php
1 month ago
admin_notices.php
1 month ago
attachment_updated.php
1 month ago
delete_post.php
1 month ago
pmxi_after_xml_import.php
1 month ago
pmxi_before_xml_import.php
1 month ago
pmxi_extend_options_custom_fields.php
1 month ago
wp_ajax_auto_detect_cf.php
1 month ago
wp_ajax_auto_detect_sf.php
1 month ago
wp_ajax_delete_import.php
1 month ago
wp_ajax_dismiss_notifications.php
1 month ago
wp_ajax_import_failed.php
1 month ago
wp_ajax_test_images.php
1 month ago
wp_ajax_wpai_dismiss_review_modal.php
1 month ago
wp_ajax_wpai_send_feedback.php
1 month ago
wpmu_new_blog.php
1 month ago
delete_post.php
15 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! defined( 'ABSPATH' ) ) exit; |
| 4 | function pmxi_delete_post($post_id) { |
| 5 | if (!empty($post_id) && is_numeric($post_id)){ |
| 6 | $post = new PMXI_Post_Record(); |
| 7 | $is_post = ! $post->getBy( 'post_id', $post_id )->isEmpty(); |
| 8 | if ( $is_post ) { |
| 9 | $post->delete(); |
| 10 | } else { |
| 11 | $image = new PMXI_Image_Record(); |
| 12 | $image->getBy( 'attachment_id', $post_id )->isEmpty() or $image->delete(); |
| 13 | } |
| 14 | } |
| 15 | } |