Repro Steps
The issue reproduces if you put an empty short-code on a page while the gated content plugin is active.
For example, active the plugin, the add the shortcode [gallery] to any page.
Explanation$atts ends up not being set by WP, which means extract() fails because it is not an array. I've opted to replace the use of extract() entirely, as a couple other sources suggested it's not recommended by WP core. Since we're only using it to get one parameter, I'm simply setting $id by accessing it from $atts if $atts exists.
There are a couple other small fixes for other warnings and notices that shows up. The one I'm most suspicious of are the changes to the 'revision' === $post->post_type guard. I have no idea what that guard is doing, but $post both wasn't defined and wasn't set, which was blowing up.
This resolves #1.
Repro Steps The issue reproduces if you put an empty short-code on a page while the gated content plugin is active.
For example, active the plugin, the add the shortcode
[gallery]
to any page.Explanation
$atts
ends up not being set by WP, which meansextract()
fails because it is not an array. I've opted to replace the use ofextract()
entirely, as a couple other sources suggested it's not recommended by WP core. Since we're only using it to get one parameter, I'm simply setting$id
by accessing it from$atts
if$atts
exists.There are a couple other small fixes for other warnings and notices that shows up. The one I'm most suspicious of are the changes to the
'revision' === $post->post_type
guard. I have no idea what that guard is doing, but $post both wasn't defined and wasn't set, which was blowing up.