-
Notifications
You must be signed in to change notification settings - Fork 108
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
There are certain snippets that should only run once like transients clean up, permalink structure reset or database handling, i suggest to add an action named code_snippets/after_execute_snippet allowing the developer to do any stuff he/she likes after the snippet executes, this way for example i could just write my own code to disable the snippet, bellow is a suggestion for the hook implementation, btw i noticed that you return the snippet eval result in execute_snippet() so i added it to the hook too.
foreach ( $active_snippets as $snippet_id => $snippet ) {
if ( apply_filters( 'code_snippets/allow_execute_snippet', true, $snippet_id ) ) {
/* Execute the PHP code */
$result = execute_snippet( $snippet->code );
do_action( 'code_snippets/after_execute_snippet', $result, $snippet_id );
}
}
One last note: semantically i think it sounds better 'allow_snippet_execute' and 'after_snippet_execute', i am not completely sure since English is not my primary language.
What do you think?
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request