| @@ 85-97 (lines=13) @@ | ||
| 82 | * |
|
| 83 | * @param mixed $field The field to delete values for. |
|
| 84 | */ |
|
| 85 | public function delete_values( $field ) { |
|
| 86 | global $wpdb; |
|
| 87 | ||
| 88 | $group_names = $field->get_group_names(); |
|
| 89 | $field_name = $field->get_name(); |
|
| 90 | ||
| 91 | $meta_key_constraint = '`meta_key` LIKE "' . $field_name . implode( '-%" OR `meta_key` LIKE "' . $field_name, $group_names ) . '-%"'; |
|
| 92 | ||
| 93 | return $wpdb->query( ' |
|
| 94 | DELETE FROM ' . $this->get_table_name() . ' |
|
| 95 | WHERE (' . $meta_key_constraint . ') AND `' . $this->get_table_field_name() . '`="' . intval( $this->get_id() ) . '" |
|
| 96 | ' ); |
|
| 97 | } |
|
| 98 | ||
| 99 | /** |
|
| 100 | * Retrieve the type of meta data. |
|
| @@ 107-119 (lines=13) @@ | ||
| 104 | * |
|
| 105 | * @param mixed $field The field to delete values for. |
|
| 106 | */ |
|
| 107 | public function delete_values( $field ) { |
|
| 108 | global $wpdb; |
|
| 109 | ||
| 110 | $group_names = $field->get_group_names(); |
|
| 111 | $field_name = $this->get_clean_field_name( $field ); |
|
| 112 | ||
| 113 | $meta_key_constraint = '`meta_key` LIKE "' . $field_name . implode( '-%" OR `meta_key` LIKE "' . $field_name, $group_names ) . '-%"'; |
|
| 114 | ||
| 115 | return $wpdb->query( ' |
|
| 116 | DELETE FROM ' . $this->get_table_name() . ' |
|
| 117 | WHERE (' . $meta_key_constraint . ') AND `' . $this->get_table_field_name() . '`="' . intval( $this->get_id() ) . '" |
|
| 118 | ' ); |
|
| 119 | } |
|
| 120 | } |
|
| 121 | ||