bbPress Topics for Posts
[resolved] PHP: how to know if a post has "topics for posts" enabl (3 posts)

  1. kuching
    Posted 3 years ago #

    I wish to make the comment form appear on posts and custom post types posts only IF the "Topics for posts" plugin IS active and IF it has been set for that specific post. Ie, a specific post has been set to open a forum topic to replace its comments.

    To check if the plugin is active, it's easy (class_exists / function_exists), but I don't know what variable to look for to check if a post has "Topics for Posts" set.

    If not set, I don't want the comment box to appear at all, since I'm exclusively using forum threads/discussions to replace WP standard commenting system.



  2. David Dean
    Plugin Author

    Posted 3 years ago #

    A post with a topic set will have a postmeta entry called bbpress_discussion_topic_id.

    A simple check would be: if( ! empty( get_post_meta( $YOUR_POST_ID, 'bbpress_discussion_topic_id', true ) ) )

    Let me know how that works for you!

  3. kuching
    Posted 3 years ago #

    thanks :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • bbPress Topics for Posts
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic