WordPress.org

Plugin Directory

Changeset 455960


Ignore:
Timestamp:
10/26/11 16:13:57 (2 years ago)
Author:
gluten
Message:

Update to version 0.2

Location:
delete-custom-fields/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • delete-custom-fields/trunk/delete-custom-fields.php

    r397506 r455960  
    33Plugin Name: Delete Custom Fields 
    44Description: Ever have one erroneously entered custom field name confuse all of your users and you just can't figure out how to get rid of it? Delete Custom Fields will let you delete every instance of a custom field from your site.  
    5 Version: 0.1 
     5Version: 0.2 
    66License: GPL version 2 or any later version 
    77Author: Sam Margulies 
     
    2626        add_management_page( 'Delete Custom Fields', 'Delete Custom Fields', 'manage_options', 'delete-custom-fields', array( &$this, 'admin_page' ) ); 
    2727    } 
    28     function get_all_meta_keys() { 
    29         global $wpdb; 
    30         $limit = 10; 
     28    function get_all_meta_keys( $include_hidden = false ) { 
     29        global $wpdb;        
     30        $limit = 50; 
     31        $include_hidden = ($include_hidden) ? "" : "HAVING meta_key NOT LIKE '\_%'"; 
    3132        $keys = $wpdb->get_col( " 
    3233                SELECT meta_key 
    3334                FROM $wpdb->postmeta 
    3435                GROUP BY meta_key 
    35                 HAVING meta_key NOT LIKE '\_%' 
     36                $include_hidden 
    3637                ORDER BY meta_key 
    3738                LIMIT $limit" ); 
     
    4243        $custom_value_query = new WP_Query( array( 
    4344            'post_type' => 'any', 
     45            'nopaging' => true, 
    4446            'ignore_sticky_posts' => true, 
    4547            'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash'), 
     
    114116        <div class="narrow"> 
    115117        <p> 
    116         <?php _e("This form will <strong>permanently delete</strong> custom fields you select along with any content associated with them. Before using this form, please <strong>make sure that you are not deleting a custom field used by your theme or plugins</strong>; just because you did not explicitly enter or create a custom field does not mean that it does not hold information used by your theme or plugins" ); ?>  
     118        <?php _e("This form will <strong>permanently delete</strong> custom fields you select along with any content associated with them. Before using this form, please <strong>make sure that you are not deleting a custom field used by your theme or plugins</strong>; just because you did not explicitly enter or create a custom field does not mean that it does not hold information used by your theme or plugins." ); ?> To show hidden custom fields <a href="<?php echo admin_url('tools.php?page=delete-custom-fields&show-hidden=true'); ?>">click here</a>. 
    117119        </p> 
    118120                 
     
    128130            <?php 
    129131             
    130             $custom_fields = Delete_Custom_Fields::get_all_meta_keys(); 
     132            $show_hidden = ($_GET['show-hidden']) ? true : false; 
     133             
     134            $custom_fields = Delete_Custom_Fields::get_all_meta_keys( $show_hidden ); 
    131135             
    132136            foreach($custom_fields as $field) { 
  • delete-custom-fields/trunk/readme.txt

    r397506 r455960  
    11=== Delete Custom Fields === 
    22Contributors: gluten 
    3 Tags: tools, admin, custom fields, delete, manage, clean 
     3Tags: tools, admin, custom fields, delete, manage, clean, remove 
    44Requires at least: 3.1 
    5 Tested up to: 3.2 
    6 Stable tag: 0.1 
     5Tested up to: 3.3 
     6Stable tag: 0.2 
    77 
    8 Delete every instance of a custom field from your site.  
     8Remove every instance of a custom field from your site.  
    99 
    1010== Description == 
    1111 
    12 Ever have one erroneously entered custom field name confuse all of your users and you just can't figure out how to get rid of it? Delete Custom Fields will let you delete every instance of a custom field from your site.  
    13  
     12Ever have one erroneously entered custom field name confuse all of your users and you just can't figure out how to get rid of it? Delete Custom Fields will let you delete every instance of a custom field from your site. Once your remove a custom field using this plugin it will not appear in your list of custom fields when you edit a post or page. 
    1413 
    1514== Installation == 
     
    2928== Changelog == 
    3029 
     30= 0.2 = 
     31* Delete all instances of custom field and not just ten at a time 
     32* Display up to 50 custom fields 
     33* Added option to show hidden custom fields 
     34 
    3135= 0.1 = 
    3236* First version 
     37 
Note: See TracChangeset for help on using the changeset viewer.