I can fiddle my way around PHP and make things work, that is, as long as it is someone else’s code.
Today I was struggling with a WordPress Plugin that refused to behave when I wanted to save changes in it’s Admin panel.
The code just would not behave.
Possibly an issue with the current version?
Anyway, I tracked down the code element.
action="<?php echo $_SERVER['HTTP_HOST'] . '?page=' . basename(__FILE__); ?>&updated=true">
For one thing, this is a security issue, so I updated it to this:
action="<?php echo admin_url( 'admin.php?page=' . plugin_basename( __FILE__ ) ); ?>&updated=true">
But that failed. After 30 mins of madness and frustration, I dropped the “plugin_” from “basename” and all was good.
action="<?php echo admin_url( 'admin.php?page=' . basename( __FILE__ ) ); ?>&updated=true">
What does it mean? I have no idea, I just know it works, and I learned it from Lester Chan. Thanks, Lester!