My guess would be you have just dropped filter into a class body in between the methods. That is invalid PHP and not going to work.
First you need to call it from where code makes sense, inside another class method or from outside a class.
Second you cannot hook methods by their name alone, you need to use proper callback with a name of the class. Examples would be [ __CLASS__, 'method_name' ]
(static method) or [ $this, 'method_name' ]
(non-static method in class instance).
And finally if you are new to PHP then spending some time with PHP manual is highly recommended, it will save you a lot of time in dealing with WordPress.
Related Posts:
- How to Remove Certain Screen Options and Meta Boxes from add/edit post type?
- check for the current screen
- Add column to plugins table screen
- Adding a responsive grid onto a page (without using a Bootstrap theme) [closed]
- Installed Forca Theme, wonder how I can alter Post editing screen
- WordPress not displaying columns to hide/show on screen options
- How can I recreate my HTML page with custom grid layout (blocks spanning rows and columns) in WordPress?
- how to change a static testimonials into dynamic
- Custom product page’s style for printing
- WordPress 5.3 update causes media library file upload to break – Cannot convert undefined or null to object
- What plugins do you commonly install on a fresh WordPress install?
- how to change default icon of custom plugin?
- List of all existing WordPress plugins
- How does WordPress official repository estimate ‘Active Installs’ of a plugin?
- How to work with Syntax Highlighter Evolved?
- WordPress Admin is displaying Not Available
- User-Specific Timezones? Hack? Plugin?
- Disable plugins on cron and ajax page
- Automattic’s eCommerce Plugin
- How to remove/hide action links cluttering under specific plugins’ names
- How to develop a community feature in the dashboard for multiauthor site
- Which hook should be used to validate custom form fields on the login form?
- Using the media uploader in a custom plugin
- Is there a plugin to protect downloads with recaptcha?
- Problem running Ajax in WordPress
- Plugin child folder?
- Theme and Plugins sharing common libraries
- All Updated Plugins Disappeared
- Counting pageviews on high-traffic cached sites
- How to change Thumbnail size of next Gen Gallery plugin?
- Questions about brute force attacks on the admin username, coming from amazon IP addresses
- What’s the _wp_desired_post_slug value for?
- Correct wp-content ownership and permissions
- How to check what plugins used to be on a WordPress installation?
- WooCommerce: Change default country on the cart page [closed]
- How can I list recent posts excerpts?
- Why isn’t “background-image: url”working with Bootstrap carousel on WP?
- Plugin Deactivate Self on Activation Errors
- What would be the advantages/disadvantages of remote plugin installation?
- Should I fetch the data managed by a plugin by using its APIs or WordPress APIs?
- Use translated taxonomy labels in plugin
- Show an image in my header.php
- Plugin appends ugly URL string to index
- White page by using filter template_include
- WordPress Keeps Logging Out – What Tests Can I Run to Solve This?
- How to save inputed data in a textbox [EDITED] [duplicate]
- User switching only with specific role and return
- WordPress Payment gateway add on form , how to add form into list or else how to submit form to next step for payment
- How WordPress is able to change locale without using setlocale
- Better ads plugin has 500.000 entries in wp_postmeta
- Render Modula Plugin Shortcode On Ajax Request
- This WordPress plugin isn’t creating links correctly
- Basics of changing plugin output
- WordPress plugin url for form submit
- how to place a link on the first post only using a plugin
- Minimizing scripts & css files that plugins add
- correctness of URL
- Override plugin template
- WordPress Update Question
- “After file loaded” action
- Add_image_size not generating correct size
- navigation among single posts
- Show Homepage (only) Hits Count
- Plugin access and Roles
- WordPress jQuery Post – Amending Variable Value Within Function Command
- Custom Post Type same name as Category
- how to display recent post by category on home page
- how to define a html folder to make it work with WordPress commands
- How to display the custom post related blog by category?
- Asking help regarding potential malware
- How to find where an image is used by it’s url
- checkout stripe with plugin contact form
- Disqus comment system not show
- Accessing data from Google Cloud Datastore in WordPress site
- Custom plugin which downloads updates from custom endpoint, extracts new version zip into a new name
- How to cache for multi server environment? Memcached, Redis or other?
- Page takes on two different formats
- Cant visualize protected password portfolio elements
- How to create multiple pages for PDFs
- How to Call Function From Separate WordPress Install on Same Server?
- How to echo a plugin’s function into a template?
- Run one-time script calling plugin functions
- Adding icons next to categories in wp_nav_menu
- Custom plugin breaks css.php on Multisite
- admin panel save option with ajax
- Woocommerce Subscriptions – Customer change subscribed product after placed
- How to Change MU/BuddyPress Group Blog New Installation Defaults [closed]
- Retrieving old forms in Contact Form 7 [closed]
- Advice on setting up private site
- is ther a plugin that will hide/show content for a scheduled period of time? [closed]
- update_post_meta not working
- Pulling Advanced Custom Fields from other pages
- Trying to use Advanced Custom Fields with custom image sizes
- Manage Inventory Without Displaying Levels
- registration plugin [closed]
- Which action/filter can i use for a Member Plugin [closed]
- Increased max_upload_filesize, but still can’t upload plugin [closed]
- How to connect WordPress media to another host?
- How to add product author carousel in wordpress? [closed]
- public custom posts not showing in my wordpress plugin