WordPress hooks only work with global functions ( or public function inside a class ) – private or protected methods are not available due to their visibility level, so not available to the way WP calls actions or filters.
What you are trying to do is tidy up your code using a class to contain all the functions (
called methods inside a class ), this seems like a good idea, until you review it – and then you notice the bad code smell – you’re writing proxy OOP – not real OOP – and this offers little justifiable benefit.
WordPress is partly responsible, but your plugin design is also responsible – you need to understand the patterns and refactor your plan – OR NOT.. because maybe it works better as procedural code than OOP…
Related Posts:
- How to add a button to custom post type’s posts-page
- How often do you need to register_post_type?
- How to register custom post types in a plugin?
- Row actions not showing? Why?
- How to append element after thumbnail
- Adding Meta Boxes while Registering a Post Type in a Class
- Dynamic Custom Post Type Plugin
- Get rewrite slug of custom post type in template
- Admin notice not displaying
- Insert Multiple Post with Same Publish Button
- Why is conditionally loading a custom plugin’s code only on a specific custom post type causing the site content to disappear?
- How to customize a permalink (URL) structure?
- Use custom metabox to update automatically a post after a given date
- Problems wp_insert_post and save_posts filter
- Show current custom taxonomy
- How exclude or skip post type with get_next_post_link
- WordPress: Custom User Role cannot access Custom Post Type | “Sorry, you are not allowed to access this page”
- How do I add custom HTML to the content of an archive page’s posts?
- Validate Custom Post Type fields
- Creating alternate meta box context locations
- Accessing a protected property of a post
- Custom post type page with parameter
- Change Dropdown jQuery to show/hide but with default place holder that shows all
- How to show the post which checkbox is not selected
- Is it possible to get the specific content on the search page?
- Title and URL Error in Breadcrumb Navigation for Custom Post Types
- Changing CPT permalink
- Dynamic page for nav items used as filters
- Having issue on Loading Meta Data From CSV to CPT
- Correct way to register custom post type from external php file?
- call a function when insert and update a custom post type
- Execute code only after user clicks ‘update’ button for CPT being edited
- Meta Box not being added in plugin
- How to string lines from the_content() hook in WordPress?
- How to dynamically register custom post type
- Admin Post Update Redirection to Posts Screen
- Date archives for custom post type
- If featured image doesn’t exist, show post content
- How do I redirect all 404 errors of a specific post type to another URL?
- Using ‘strtotime’ function to convert a custom-meta-box to a date-stamp
- How to save the checked boxes?
- What hook should be used to programmatically create a post only when master post is updated?
- template_redirect not working, apparently for no reason
- Append taxonomy terms as class names in markup?
- Using WPAlchemy metabox values in another metabox
- GravityForm: Populate Dropdown with custom post type [closed]
- How to output wordpress custom tags separated by comma?
- Custom Post Type rewrite
- Add custom column in custom post type edit page
- Dynamic page outside WordPress
- Changing number of posts per page on CPT-archive.php, have tried 20-30 code chunks so far
- Custom Post Type Loop throws 500 error when used in widget
- Adding a custom post type taxonomy template in plugin
- Plugin: register custom post types, child ready and performance best practices
- I need to add endpoint for wordpress categories
- Getting meta in editor plugin, and event triggering issue
- Hide a widget inside a div on specific type of post
- How to use TinyMCE Editor for one of my custom post meta field?
- How to import a custom MySQL DB table into a WordPress custom post type
- Deleting taxonomy terms and relationships on a custom post_type when a user is deleted
- Foreach inside shortcode not working as planned
- Displaying custom field according to date
- Add additional field to custom post_type
- Save Multiple Metabox values
- Get rid of “trash can” for custom post type
- custom post for slider
- Using wp_query to modify the loop in index.php for a CPT
- Create short URL with auto 301 redirect
- Creating shortcode id for custom post types
- Types plugin custom post add_action hooks
- Different column width in 2 rows with bootstrap and custom post types-different classes needed
- comments hooks on custom post type
- Not Able to Add New Class To CPT Attachment Image
- Call to “admin_notices” hook from a static method
- Orderby custom fields is not working
- I’m having trouble with Related Product “tax_query” ‘terms’ value
- How to stop the custom post type URL from the google search?
- WordPress Custom Post Loop
- WP_Query – How To Query Only Custom Posts With No Children of Their Own?
- programmatically generated custom post type is created more than once
- ‘Simple’ Reservation System
- Create posts inside CPT post
- Hook create / update post
- Taxonomies are not showing in the category dropdown
- Combine multiple separate lists into one
- Show Post columns to specific users on condition
- Custom Taxonomy – fields
- Custom Post type plugin is using theme single.php and style.css
- Print post category name from a custom post type wordpress
- CPT post doesnt shows tags and category on backend admin page
- do action inside a class is not working
- Registering an optional custom post type from a plugin
- Get month and day from a Date Picker custom field
- Generate custom RSS from a plugin
- calling a function from a class in your template
- is_singular won’t call my functions?
- Inserting two categories
- Comments are not working on Custom Post Type
- Custom post type is_singular condtional not working when managing sidebar display
- How to consume external API from WordPress post editor and display the response data in the custom field?