| @@ -112,8 +112,13 @@ | ||
| 112 | 112 | $edit_html = ob_get_clean(); |
| 113 | 113 | |
| 114 | 114 | $tags_html = ''; |
| 115 | 115 | |
| 116 | + if( $item_type === 'trigger' ) | |
| 117 | + delete_transient( 'automatorwp_triggers_in_use' ); | |
| 118 | + else if( $item_type === 'action' ) | |
| 119 | + delete_transient( 'automatorwp_actions_in_use' ); | |
| 120 | + | |
| 116 | 121 | // Set up the trigger tags html |
| 117 | 122 | if( $item_type === 'trigger' ) { |
| 118 | 123 | |
| 119 | 124 | // Get the trigger tags |
| @@ -126,8 +131,9 @@ | ||
| 126 | 131 | } |
| 127 | 132 | |
| 128 | 133 | // Set up the action tags html |
| 129 | 134 | if( $item_type === 'action' ) { |
| 135 | + | |
| 130 | 136 | // Get the action tags |
| 131 | 137 | $tags = automatorwp_get_action_tags( (object) $object ); |
| 132 | 138 | |
| 133 | 139 | if( ! empty( $tags ) && isset( $tags[$id] ) ) { |
| @@ -141,13 +147,12 @@ | ||
| 141 | 147 | 'edit_html' => $edit_html, |
| 142 | 148 | 'tags_html' => $tags_html, |
| 143 | 149 | ) ); |
| 144 | 150 | } else { |
| 145 | - if( $item_type === 'trigger' ) { | |
| 151 | + if( $item_type === 'trigger' ) | |
| 146 | 152 | wp_send_json_error( __( 'Trigger can\'t be created.', 'automatorwp' ) ); |
| 147 | - } else if( $item_type === 'action' ) { | |
| 153 | + else if( $item_type === 'action' ) | |
| 148 | 154 | wp_send_json_error( __( 'Action can\'t be created.', 'automatorwp' ) ); |
| 149 | - } | |
| 150 | 155 | } |
| 151 | 156 | |
| 152 | 157 | } |
| 153 | 158 | add_action( 'wp_ajax_automatorwp_add_automation_item', 'automatorwp_ajax_add_automation_item' ); |
| @@ -183,8 +188,13 @@ | ||
| 183 | 188 | |
| 184 | 189 | ct_delete_object( $id ); |
| 185 | 190 | |
| 186 | 191 | ct_reset_setup_table(); |
| 192 | + | |
| 193 | + if( $item_type === 'trigger' ) | |
| 194 | + delete_transient( 'automatorwp_triggers_in_use' ); | |
| 195 | + else if( $item_type === 'action' ) | |
| 196 | + delete_transient( 'automatorwp_actions_in_use' ); | |
| 187 | 197 | |
| 188 | 198 | // Send back a successful response |
| 189 | 199 | wp_send_json_success( __( 'Item deleted.', 'automatorwp' ) ); |
| 190 | 200 | } |