Bohdan Hdal
Bohdan Hdal

Reputation: 149

How i can filter (hook) function inside Wordpress Class?

I have a plugin example:

class ProductCustomPostType {
        function __construct() {
            ..
            add_action( 'manage_posts_custom_column', array( $this, 'managePostCustomColumns' ) );
            }

    function managePostCustomColumns( $column_name ){
    ...
    }
   }

I need to hook function managePostCustomColumns from functions.php with add_filter action.

How i can do it? Thank you!

Upvotes: 3

Views: 3771

Answers (2)

Robot
Robot

Reputation: 540

take a look at the link and look at comments too, answer is in comments. this might help you.

Override plugin with functions.php

Upvotes: 0

Maxim Krizhanovsky
Maxim Krizhanovsky

Reputation: 26699

If you want to hook custom code when a filter is applied, you have to call:

add_filter( 'manage_posts_custom_column', array( $this, 'managePostCustomColumns' ) );

If you need to call all functions, hooked to a specific filer, use:

apply_filters('manage_posts_custom_column', 'column_name')

Upvotes: 1

Related Questions