This is more a PHP question than a WordPress one. WP’s add_action
and add_filter
functions just accept a PHP type known as “callables”.
Essentially, when you want to pass an object instance’s method as a callback, you do so using the syntax you see here – an array where the first element is the object instance, and the second element is the name of the method.
Related Posts:
- Showing User’s Post Counts by Custom Post Type in the Admin’s User List?
- get all posts from a custom post type
- Confusion with adding meta capabilities to a role after registering a Custom Post Type with corresponding ‘capability_type’ parameter
- Display content from custom meta boxes in revisions
- Custom taxonomy not showing up when adding a new custom post type
- Including Custom Post Types in “Recent Posts” Widget
- query multiple taxonomies
- WP cron: when to schedule a 1-time event
- Pre get posts for single post
- Custom Posttype Inheritance (and url structure)
- How to get custom metabox image field?
- Custom Post Types – Capability Type
- Custom Post Type Archives by Date (stored as meta value) WP3.1
- Rewrite permalinks for custom posttype and custom taxonomy
- How to check if last uri segment is a custom post type or taxonomy term?
- Pass parameter to custom post type single while keeping clean url
- Pagination Doesn’t Work
- filter search result with custom post type meta key
- Load custom post type in a different WordPress installation
- Adding a date archive to Custom Post Type
- Automatic category for a Custom Post Type
- Disable All In One SEO Pack for some custom post types [closed]
- Automatically check “Allow comments” for custom post type [duplicate]
- Trying to manage templates on a blog with lots of custom taxonomies
- Get the post children count of a post
- Link images to post permalink – custom post types
- Display Custom Category (taxonomy) Name in Custom Post Type
- Recommended way to remove WP REST API returned data for custom post
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- Use get_post_types to query only custom posts types
- Custom Post Type + 20k posts = blank/404 within Admin edit.php [duplicate]
- Rewrite WordPress URL to show CPT meta field data
- Create/Edit posts and auto-redirect back to listing page
- How to load a template without it being assigned to a page/post?
- Is it possible to list and create custom post types with Vimpress?
- Set menu active state for custom posttype and category, given custom taxonomy term
- How to duplicate fields in custom post types?
- Custom Post Type Tag Capabilities Not Working
- different post-class when template is loaded via ajax
- Custom post type structure for posts with multiple child posts
- Hide parent categories when clicked, and show it’s childs
- Get unique superset of taxonomy terms from a list of custom posts in another hierarchical taxonomy
- current post index within content.php
- Multiple (two) category postings on the same page.
- Admin Column does not populate with data
- “Submit for review” for updates on existing posts
- Auto Complete Search
- Can multiple authors be assigned on a single custom post?
- permalink /category/post-name with custom post type and taxonomy
- Creating a Custom Post Type and Joining with Users
- Not getting posts of custom post types
- Custom post type pages return 404 page?
- Pagination custom post type not working with rewrite slug
- Pagination Not Working for Custom Taxonomy with Custom Query – 404 Error
- How can I have different content for different countries?
- ACF repeater field usage
- Is it possible to add posts and images (auto resize) for custom post types with a script?
- Retrieving meta-box from a custom-post-type
- Loop through posts of only 2 statuses
- providing access to post_id or post inside functions.php
- custom query with custom post type and category slug
- Overriding Plugin Function in Child Theme
- Function to limit number of custom post types on homepage – TwentyTen
- Get custom category ID of current custom post within the loop
- Post query missing an elseif statement
- How to limit what Editors see in the admin?
- Update custom post type title
- Custom Post Type Template Insert not working properply
- Custom Post Type Pagination on Single.php?
- display custom post on separate page
- Add custom post type to query
- How does one go about converting custom post type to post format?
- How to display magic field’s custom write panel in wordpress theme?
- Admin slow on Postlist (over 30k Posts in Database)
- How can i show ACF in post excerpts
- Custom post type category link redirecting to 404 page
- Disable single page for a custom post type based on a custom field
- Setting Custom Post Type Parents/Hierarchies
- Query to Exclude Child Pages from Custom Post Type Archive
- Getting a Post ID to show its content in a Popup
- How to output custom post type title on custom page with category next to it?
- How to make password protected posts that will expire after they are used?
- Automatically / dynamically populating tags in custom post type
- Remove CPT Slug with 2 taxonomies and 1 post meta
- Single Page of Custom Post Type Not Showing the Content Of post
- Multiple loops for custom post type to spread data across rows
- Generate slug and meta data if meta field is empty
- Why is a custom post type’s URL “/?cposts=name-of-the-post” but default post’s URL is “/?p=ID”?
- Redirect Custom Post Type after user submits update
- WP_Query get posts where post_name is empty
- Display all post types together
- Custom Post Type Tags Showing Under Regular Post Tags
- Taxonomy and Rewrite Structure
- Pagination for a Custom Taxonomy
- Pagination for event query
- Problem retrieving custom field for a custom post type
- Only One Post of Custom Post Type Appearing on Template Page
- Remove custom meta boxes from custom post type
- Custom taxonomy meta fields
- WP Query – Can’t get posts with specific taxonomy