Title: Add a Remove button (w/ code)
Last modified: January 4, 2018

---

# Add a Remove button (w/ code)

 *  [chriscombsdc](https://wordpress.org/support/users/chriscombsdc/)
 * (@chriscombsdc)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/add-a-remove-button-w-code/)
 * hello! We modified the plugin to add a Remove button to each item in the post
   order list.
 * posts_order.php
 * line 287 add
 *     ```
       			if ( isset( $_POST['removesingle'] ) ) {
       				foreach($_POST['removesingle'] as $order=>$post_id)
       				{
       					$meta_key = '_sort_' . $this->term_id;
       					wp_remove_object_terms( $post_id, intval($this->term_id), $this->taxonomy );
       					delete_post_meta( $post_id, $meta_key );
       				}
       			}
       ```
   
 * line 334-336 update to
 *     ```
       						<li style="margin: 0; background: #FFF; padding: 8px 8px; border-bottom: 1px solid #EEE; cursor:move;" id="sorthandle-<?php the_ID();?>">
       							<input type="hidden" name="sort[]" value="<?php the_ID(); ?>" />[<?php echo $order; ?>] <?php the_title(); ?> [<?php echo get_the_date("Y-m-d"); ?>] (<?php echo get_post_status(); ?>) <span style="float: right;cursor: pointer;color: red;" onClick="jQuery('#sorthandle-<?php the_ID();?>').hide();jQuery('#sorthandle-<?php the_ID();?> input').attr('name','removesingle[]')"> Remove</span>
       						</li>
       ```
   
 * You are welcome to integrate this into the plugin.

The topic ‘Add a Remove button (w/ code)’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/category-custom-post-order_ffffff.
   svg)
 * [Posts Order](https://wordpress.org/plugins/category-custom-post-order/)
 * [Support Threads](https://wordpress.org/support/plugin/category-custom-post-order/)
 * [Active Topics](https://wordpress.org/support/plugin/category-custom-post-order/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/category-custom-post-order/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/category-custom-post-order/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [chriscombsdc](https://wordpress.org/support/users/chriscombsdc/)
 * Last activity: [8 years, 5 months ago](https://wordpress.org/support/topic/add-a-remove-button-w-code/)
 * Status: not a support question