WordPress.org

Ready to get started?Download WordPress

Forums

Document Feedback
[resolved] Adding Feedback to Posts using Filters (2 posts)

  1. troyward
    Member
    Posted 1 year ago #

    I am trying to add document feedback prompt to posts. I know there is a filter for that so I am trying to apply that filter using this in my theme's functions.php file but it is not working. I think I am using the wrong syntax, can you please provide an example of how to add posts?

    $feedback_post_types = array(
    'post',
    'page',
    );
    apply_filters('document_feedback_post_types', $feedback_post_types);

    http://wordpress.org/extend/plugins/document-feedback/

  2. nofearinc
    Member
    Plugin Contributor

    Posted 1 year ago #

    The apply_filters is used for 'applying' added filters, so you need to add a callback function with add_filter that returns your post types, more specifically:

    function your_document_feedback_post_types( $post_types ) {
        $feedback_post_types = array(
            'post',
            'page',
        );
    
        return $feedback_post_types;
    }
    
    add_filter( 'document_feedback_post_types', 'your_document_feedback_post_types' );

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.