Skip to content

Commit 8826444

Browse files
authored
Merge pull request #32 from bradyvercher/fix/non-existent-options
Allow non-existent options to be monitored.
2 parents 736891c + 0071a34 commit 8826444

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/class-plugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ public function reset( $should_reset = true ) {
100100
*/
101101
public function monitor_option_accesses( $tag ) {
102102
// Check if the tag is related to an option access.
103-
if ( strpos( $tag, 'option_' ) === 0 ) {
104-
$option_name = substr( $tag, strlen( 'option_' ) );
103+
if ( str_starts_with( $tag, 'option_' ) || str_starts_with( $tag, 'default_option_' ) ) {
104+
$option_name = preg_replace( '#^(default_)?option_#', '', $tag );
105105
$this->add_option_usage( $option_name );
106106
}
107107
}

0 commit comments

Comments
 (0)