I created a class instance and referenced that in add_action
, which is moved below where the instance is created:
if ( ! function_exists('add_action') ) {
header('Status: 403 Forbidden');
header('HTTP/1.1 403 Forbidden');
}
if ( ! class_exists('My_Authentication') ) {
class My_Authentication {
public function setup() {
add_action('wp_login', array(&$this, 'no_auth_allowed') );
add_action('wp_logout', array(&$this, 'no_auth_allowed') );
}
public function no_auth_allowed() {
wp_die('no authentication for you!');
}
}
$my_auth = new My_Authentication;
}
add_action('plugins_loaded', array($my_auth, 'setup') );
Related Posts:
- Is it ever okay to include inline CSS in plugins?
- In Which Contexts are Plugins Responsible for Data Validation/Sanitization?
- Plugin Form Submission Best Practice
- Best way to abort plugin in case of insufficient PHP version?
- How can I configure Docker for developing and deploying a custom theme?
- What do you think about custom designed plugin/theme options UIs?
- No Error Log File, no debug info
- Where to put third party PHP library?
- Is the new WordPress 3.1 admin bar pluggable and how can I extend it?
- How to use PanelColorSettings in custom Gutenberg block?
- Getting a peer review for my new plugin?
- Optimize shortcode callbacks
- How to integrate a PHP webmail script into the backend of WordPress?
- Using filters and actions for plugin API?
- How to Change the Entire WordPress Admin panel Look and Feel?
- How to log plugin errors to plugin error_log file
- Which to use to execute code during the saving of a plugin settings page?
- Allowing for multiple template views on the Gallery Settings page when using the Visual Editor
- Using Primary Color in Plugin Block
- When is it appropriate to put functions on page template vs. functions.php?
- Custom theme sufficient or custom plugin neccessary for this feature set?
- How to create custom home page via plugin?
- Adding callback function for wp_ajax_ has no effect
- Sessions not creating correctly in custom function
- Featured Image not showing in admin
- How to use wp_set_password in a plugin?
- Delete a specific item menu when I deactivate my plugin
- Are we allowed to use the Allman (BSD) indent style when coding WordPress plugins and themes?
- Get the password key when using the wp_new_user_notification_email filter
- Order properties should not be accessed directly
- How to deal with equal & similar arguments for a function?
- Executing a function upon webhook calling wordpress
- Customizer: widget-synced triggers twice
- WordPress not working on localhost
- how to use hook deleted_user into custom function to delete user from custom table
- Disable The Events Calendar plugin from loading its scripts
- Where to store the name of a custom table?
- WordPress is automatically linking plain text email addresses
- Is Using WordPress Supplied WYSIWYG Advisable?
- ServerSideRender and Media Object: attributes passing image data object to php renderer even though it’s not set
- Clearing caches on plugin uninstall
- How to use a hook to override an update_post_meta call in a plugin?
- Add code inside specific wordpress standard function
- Custom Taxonomy to dropdown box on adminside wordpress
- How to modify the comments to be displayed in a post?
- How can we display product price $104 on the cart while the credit card payment method is checked?
- Search: how to extend the existing search to include a custom table
- Is there documentation reference for forms in menu and setting pages?
- Enqueue script globally
- How to modify files inside wp-includes directory in wordpress
- Custom entity search and display
- How to set a cookie for logged in users to md5($user->ID . “my_secret”)?
- Plugin: database creation
- Loading Modernizr (or other JavaScript libraries) for use in a plugin
- Show message from backend
- Create Widget or Enable Shortcodes in Sidebar
- Logout after clicking URL link results in “headers already sent” error
- how to save wp_editor html content in options table
- How to use a WP_Customize_Control outside of the Customizer?
- How to remove/replace current page template?
- Setting a post’s category
- Extract Information from post content (using regex?)
- How to determine which capability to use?
- Customise Grouped Product display in Woocommerce with custom column
- Custom Endpoint – Does it possible to use PUT method with WP API Rest?
- Why won’t this submenu page show? – My First WordPress Plugin
- Want to know how to reveal a WordPress theme, considering the theme name is hidden?
- Metabox types list
- Where to save Gutenberg plugin data?
- WordPress how do I echo SUM from a column of a MySQL table by user id AND type_operation
- Rate limiting ajax requests in WordPress
- Does hooking into a plugin action / filter override the plugin’s function for that hook?
- How to prevent users from deleting their accounts?
- Hiding class namespace from plugin’s extensions
- Set widget icon in Customizer?
- Determine if the current page, is being edited
- WordPress delete mysql rows with string
- external Integration with wordpress timeout error
- Add function to Dokan ajax class
- PHP includes with AJAX actions
- Making adding info to an overlay bio easy for average user?
- Implementing Select2 plugin into WordPress
- Custom Post Type and Functions
- Associating special meaning with user id 0
- Can I access WordPress API’s from within plugin scripts?
- Theming Custom Plugin Page
- Best practice: What belongs in theme and what in plugin for large eCommerce website
- Link to a admin submenu item using a custom link
- Adding class to the parent of current-post-ancestor / current-menu-parent / current-post-parent
- Change the search results header from plugin
- Dynamic banner for use on external sites
- Adding Meta box to thrid-party plugin
- How do I store a custom dataset in WordPress to best take advantage of API?
- Developing Themes on WordPress, Looking for Excellent Tutorials [closed]
- How to Implement SAM Broadcaster with WordPress? [closed]
- Is Explicit Versioning a better alternative to Semantic Versioning for wordpress?
- Custom plugin not appearing
- Extend WP_List_Table class – Edit wp_usermeta – WPPB.me Boilerplate – Action error
- Is there any other ways to replicating changes on live from staging without pushing from git
- Can I log the searches that are returning 404 in the DB?