Source View: comments_open

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
768  *
769  * @param int $post_id An optional post ID to check instead of the current post.
770  * @return bool True if the comments are open
771  */
772 function comments_open( $post_id = null ) {
773
774      $_post = get_post($post_id);
775
776      $open = ( 'open' == $_post->comment_status );
777      return apply_filters( 'comments_open', $open, $post_id );
778 }
779
780 /**
781  * Whether the current post is open for pings.
782  *
783  * @since 1.5.0
784  * @uses $post
785  *
786  * @param int $post_id An optional post ID to check instead of the current post.