The preprocess_comment filter is never run when an empty comment is submitted.
The empty check happens before wp_new_comment() is called and the preprocess_comment filter is applied in wp_new_comment()
| <?php | |
| /********************************************* | |
| Contests CPT | |
| **********************************************/ | |
| /* Contest CPT :: Initiate CPT | |
| **********************************************/ | |
| function vs_register_contests_post_type() { |
| <?php | |
| /** | |
| * Example usage to find all Titles with a comma: | |
| * $example_query = new WP_Query( | |
| * array( | |
| * 'title_like' => ',' | |
| * ) | |
| * ); | |
| */ |
| <?php | |
| /** | |
| * Genesis: Only display post info when post type is "post" | |
| */ | |
| remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); | |
| add_action( 'genesis_entry_header', 'fe_genesis_post_info', 12 ); | |
| function fe_genesis_post_info() { | |
| if ( 'post' === get_post_type() ) { | |
| genesis_post_info(); |
The preprocess_comment filter is never run when an empty comment is submitted.
The empty check happens before wp_new_comment() is called and the preprocess_comment filter is applied in wp_new_comment()
| jQuery('#commentform').on('submit', function() { | |
| var $comment = jQuery('#comment'); | |
| if ( '' === $comment.val().trim() ) { | |
| $comment | |
| .css({'color':'#fff'}) | |
| .val( 'Automated Comment: ' + Math.floor( new Date().getTime() / 1000 ) ); | |
| } | |
| }); |
| <?php | |
| /** | |
| * File for home.php | |
| * | |
| * Blog page template with page description before blog posts. | |
| * | |
| * @package example; | |
| */ | |
| add_action( 'genesis_before_loop', 'fe_home_genesis_before_loop' ); |
| <?php | |
| /** | |
| * Register CPT `fe_recipe` | |
| */ | |
| add_action( 'init', 'fe_recipe_cpt' ); | |
| /** | |
| * Register CPT `fe_recipe` | |
| */ |
| <?php | |
| /** | |
| * The code to register a WordPress Custom Post Type (CPT) `fe_recipe` | |
| * with a custom Taxonomy `fe_recipe_tag` | |
| * @package fe_recipe | |
| */ | |
| add_action( 'init', 'fe_recipe_cpt' ); | |
| /** |
| <?php | |
| /** | |
| * Set the number of posts on the Custom Post Type archive for `fe_recipe` to 5. | |
| */ | |
| add_action( 'pre_get_posts', 'fe_modify_number_of_posts_per_page' ); | |
| /** | |
| * Modify Posts Per Page for CPT `fe_recipe` | |
| * |
| <?php | |
| /** | |
| * Prevent top level permalink slugs that will cause conflicts. | |
| * | |
| * New rewrite slugs are introduced when CPTs or Custom Taxonomies are created. | |
| * This code adds a check when Pages or Posts are created, that their Permalink | |
| * does not conflict with one of the reserved top level slugs you define. | |
| * | |
| * In the case of a bad (i.e conflicting slug), WordPress appends a "-2" to | |
| * the permalink. |