The $id
variable is never set. Use this instead:
wp_trash_post( $postid );
Related Posts:
- Remove Trash / Delete option for Custom Post Type / Taxonomy
- Error after deleting Custom Post Type with a function (no trash used)
- Dynamically create/remove terms in taxonomy when custom post type is published/trashed
- Custom Role can’t trash Custom Post Type
- Get rid of “trash can” for custom post type
- How to display “Trash” in my custom post type?
- Bulk trashing post ‘fails’
- WordPress deletes custom posts instead of trash them
- Create action running on trashed_post hook to modify post_meta value
- How can I remove the “Add New” button in my custom post type?
- Submit post and upload image from front-end
- How to disable generation of default image sizes for some custom post types?
- Development of a WordPress Search Plugin – Best Practices
- Mini-Site Strategy
- How To Remove These Stuffs From Custom Post Type List Screen?
- Using Custom Fields in Custom Post Type URL
- How do I Filter Custom Post Type by Custom Taxonomy in the newest WordPress RESTful API?
- How to list all categories and tags in a page?
- show tags of custom post type ONLY
- Hierachical Custom post types permalinks not working
- TV Show database – Best way for structuring it?
- Why is the »_builtin« parameter not advised in »register_post_type()« for custom post types?
- Display posts of custom type in hierarchical order
- Many to Many Taxonomies or rewrite rules?
- Query posts by custom post type and custom taxonomy
- How to display the rest of categories on Portfolio filterable
- Get post info inside modal window?
- Custom Post Type Name Causing Problem
- is_singular just won’t work [closed]
- attach one post from one post type to another post from another post type
- How to get current post id of a custom post type in a loop using template singel-{custom type}.php?
- get_template_part for custom post type content not working
- Creating Accordians in WordPress Theme
- Multiple custom post type loops in category.php
- WordPress post count not showing for custom post type author
- Can I make WordPress use a custom template for a child page
- Display Posts in Custom Post Types Timber
- Find the user who initially created the post
- remove permalink “front part” for custom post type
- Is there a way to have the view link on manage posts page to open in a new window or tab?
- Display custom fields on post excerpt or teaser
- How to Mass Delete Images from Media Library
- Getting a PHP Notice when using Pods with WPML [closed]
- Extending AZIndex plugin to use custom post types and custom taxonomies
- wordpress wp_list_pages help
- A better way to add a meta box to custom post types
- What’s the WP way to load remaining custom posts?
- Manage custom post type in woocommerce /my-account/ page
- Permit users with author role to edit a custom post type
- Custom post Type, child of a Page?
- How to add a contribute page
- Hide or disallow default custom post type url?
- Different results between permalink and query var search
- Best structure / rewrite rules to achieve the following url
- 404 Error on form submission within custom post type
- Query of custom post types only shows first post
- I don’t understand why use array inside the add action hook to create custom post type using object oriented way
- Can I restrict category availability?
- New “Custom Types” item in admin menu. Is this a plugin or a new wordpress feature?
- Programatically inserted posts not showing in Posts Table
- Can’t use pagination with custom taxonomy
- Custom post type paging 404 error
- Targeting categories in custom fields
- Custom Post Type UI with ACF
- Can a custom post type be used as a ‘parent’ on a normal page?
- Methods for development wordpress themes [closed]
- unapprove comments on custom post type
- Custom post type specific category box
- Making a form for user to add new custom post with custom taxonomies and custom fields
- Custom post type pagination error
- CPT: Enable Gutenberg, but disable editor field
- Publish box in CPT remove ‘edit’ link
- How do I troubleshoot pre_get_posts with Debug Bar?
- How to only get the content of post page while looping?
- How to add badge “new” to the post title which are showed in recent post widgets in wordpress
- Staggering featured post using ‘sticky’
- Delete Custom Posts & Attachments
- How can I get the last 5 element of this tax query?
- How to save post title before publish?
- WooThemes – Vendors / Bookings – Allow Vendors to manage resources
- Metaboxes in Loop
- order taxonomy alphabetical
- Query breaking with ‘posts_per_page’ => -1
- Custom post type archive page not showing on archive-posttype.php
- Implement post status update as frontend news announcement
- Custom Post Type Organisation – Taxonomies, Categories and Pages
- Expandable WordPress content (text) inside a post
- Exclude categories For Custom post types
- Custom Post Types and rewrite rules – One CPT works and a cloned one doesn’t
- Sort a custom post type loop by a custom taxomomy instead of chronologically
- Custom Post Type supports author
- Add custom taxonomies as class names to an archive page of custom post types
- WordPress URL Problems and Layout
- Custom post type & role issues
- Querying meta values within an array
- Filter Custom post type by another Custom post type
- How to add custom column to Custom post page list?
- Show search for data extracted from metabox
- Custom order of CPT posts by title, in wp-admin area by default
- Dynamically count the number of custom post types associated to a custom taxonomy