Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter Mattias01

    (@mattias01)

    Thanks for the lead Will

    so this code would go in the functions.php file…

    /**
     * Filter whether comments are open for a given post type.
     *
     * @param string $status       Default status for the given post type,
     *                             either 'open' or 'closed'.
     * @param string $post_type    Post type. Default is <code>post</code>.
     * @param string $comment_type Type of comment. Default is <code>comment</code>.
     * @return string (Maybe) filtered default status for the given post type.
     */
    function wpdocs_open_comments_for_myposttype( $status, $post_type, $comment_type ) {
        if ( 'myposttype' !== $post_type ) {
            return $status;
        }
    
        // You could be more specific here for different comment types if desired
        return 'open';
    }
    add_filter( 'get_default_comment_status', 'wpdocs_open_comments_for_myposttype', 10, 3 );

    but what would I need to change ‘myposttype’ to for a custom page template?

    thanks

Viewing 1 replies (of 1 total)