plugin_basename is a WordPress function that gets your plugins file name by simply passing it the directory.
When you call $this->plugin_basename
PHP is looking for a function plugin_basename defined within YOUR class. No function plugin_basename() in your class == PHP Fatal Error.
If you simply want to define a variable that contains the plugins file name do this:
var $plugin_filename = plugin_basename( __FILE__);
Related Posts:
- Manually set global $post vars with an ID, in order to use template tags
- How to not allow users to create new tags, but allow to them to use existing ones
- How to export comments in WordPress?
- Gutenberg disallow certain custom blocks but keep all core blocks?
- Publish author posts only with editor approval?
- Limit access to posts/pages by user roles
- Remove Google Fonts Which Are (Probably) Added By Plugins
- Customizing subject in comment notification e-mails
- Common functionality between my own plugins
- WP showing “warning: call_user_func_array()”, What to do?
- Adding a text domain to every __(), _e() and __n() gettext call without a plan to create own translations
- Declare a function before plugin does on the theme functions.php file
- Editor access to plugin settings
- Saving Plugin settings to the database
- Shortcode display outside the div
- Removing user contact methods works from functions.php but not from a plugin
- Custom Widget outputs the input but doesn’t save anything inside the textarea
- Use functionality of 2 wordpress plugins
- How can i change an image’s author?
- Can wp_script_is used in pluginA check if a script is being enqueued/registered from pluginB?
- Set WordPress Featured Image For All Post Slugs Matching Image File Name in Specified Directory
- Showing Co-Authors on post page
- Debugging Technique Question re: functions.php
- Where to place custom functions?
- WP Job Manager Category Drop-down; Change Placeholder Text Via Filter
- Custom Taxonomy Tag Search
- Redeclare theme’s function in a plugin
- Change wordpress current_time function to different timezone
- How to override a plugin function wrapped in a class?
- Edit Yoast SEO breadcrumbs output [closed]
- Snippets: is it better to add them in functions.php or make site-specific plugins?
- Using a post-signup hook to get user details
- Restrict media upload size by format
- Calling plugin function inside custom plugin for onclick event
- Show function to super admin
- Facebook Messager Plugin
- All sites themes functions.php have been changed
- Plugin is a widget, but I want to call it in the head, can I?
- Cannot get wpdb data (Error in a simple fuction) [closed]
- Basics of changing plugin output
- Why can’t I call a (member) function from within a foreach?
- Are there action hooks for comments?
- Help with WP Business Directory Manager Plugin?
- Return multiple values in a shortcode attribute
- Shortcode Attributes to Return different $_POST
- Plugin onclick button activate other plugin
- Loading a plugin’s js file from functions.php
- Activate and deactivate plugin automatically
- dynamic name of the style for wp_enqueue_style
- WordPress function to add text warning on every pages [closed]
- How to access OOP plugin function inside themes or other plugin
- Different registration form for different roles
- Call javascript functions from each page
- Add_image_size not generating correct size
- Elementor Pro display featured image on section -> style -> image using shortcode
- How can i call a functions.php function, from inside my plugin class?
- How to make WooCommerce payment method field optional?
- Create a pdf from the entries in DB
- RSS feeds for specific topics
- add_rewrite_rule to load different page, without changing URL in browser
- WordPress Custom Hook with Class method
- Allow a particular user to access a particular plugin?
- how to define a html folder to make it work with WordPress commands
- add a hook of Woocommerce to a plugin but it only shows and doesn’t function properly
- ACF Fields are not showing up on Homepage
- Adding discount functionality to the cart
- Precheck fields when I add a new post
- Use buddypress function outside of plugin
- Securing langugae folder
- WPML – Hook when language is switched (change user language)
- Call function with button and return response
- Use action, filter, or hook to append HTML to WordPress plugin function
- Change custom rewrite rule when permalink is updated/changed
- Return function results within shortcode
- Save Post Permalink In .txt File
- Why is WP template_include overwritting all templates rather than specified page?
- How To Add Code To WP Without Plugin or Functions
- Disqus comments count taking long to update
- plugin not hooking to my custom hook
- Populate select option with JSON file
- How to Call Function From Separate WordPress Install on Same Server?
- Home page letters
- How to echo a plugin’s function into a template?
- Find all strings between an enclosing shortcode
- Wp Ecommerce Reposition Product Page Product Thumbnail Image
- It possible to implement an adhoc php web application with wordpress?
- How to Overwrite validate_plugin function
- making a glossary with wordpress
- date function not correctly returning date
- Disable plugin function
- Trying to output a “Most visited blogs” list in wordpress multisite
- Access to wordpress method inside of classes
- How to prevent page load on form submission
- Send email notification when meet the condition
- WordPress: code structure
- Create WordPress category dynamically
- How to disable plugin capability : “create new category”
- Option value not getting updated until page refresh in WordPress
- WordPress Custom Page Blog Template Pagination Problem (Pagination Not Displaying)
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode