[wp-trac] [WordPress Trac] #34230: Wordcount broken in frontend (v. 4.3)

WordPress Trac noreply at wordpress.org
Fri Oct 9 13:45:24 UTC 2015


#34230: Wordcount broken in frontend (v. 4.3)
--------------------------+-----------------------------
 Reporter:  finnj         |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  TinyMCE       |    Version:  4.3
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 With the update of wordcount in version 4.3, wordcount stopped working in
 frontend.

 I am the author of Frontier Post plugin, and users have reported this. To
 check I have made the below simple plugin, and tested it with version
 4.2.5 & 4.3.1. wordcount works with 4.2.5, and not with 4.3.1.

 Steps to reproduce:
 1. Install attached plugin.
 2. Create a page with [frontier-test-wordcount]
 3. View the page, and write a couple of lines of text


 {{{
 <?php
 /*
 Plugin Name: Frontier Test Wordcount
 Plugin URI: http://wordpress.org/extend/plugins/
 Description: Test wordcount
 Author: finnj
 Version: 1.0.0
 Author URI: http://wpfrontier.com
 */


 function frontier_test_wordcount()
         {
         $frontier_permalink = get_permalink();
         $tmp_text                       = "Test";

         ob_start();

 //***************************************************************************************
         //* Start form
 //***************************************************************************************

         echo '<div class="frontier_post_form"> ';
         echo '<form action="'.$frontier_permalink.'" method="post"
 name="frontier_test_wordcount" id="frontier_test_wordcount"
 enctype="multipart/form-data" >';

         echo '<table ><tbody><tr>';
                 echo '<td >';

                 wp_editor($tmp_text, 'test_wordcount', array('dfw' =>
 false, 'editor_height' => 300, 'drag_drop_upload' => true ));

                 printf( __( 'Word count: %s' ), '<span class="word-
 count">0</span>' );


                 echo '</td></tr></table>';
         echo '<button class="button" type="submit" name="user_post_submit"
 id="user_post_submit"   value="savereturn">Submit</button>';

         echo '</td></tr></table>';
         echo '</form>';


         // end form file
         $fp_content = ob_get_contents();
         ob_end_clean();
         return $fp_content;

         }

 add_shortcode("frontier-test-wordcount","frontier_test_wordcount");

 //*******************************************************************************************
 // Load wordcount
 //*******************************************************************************************

 function frontier_enqueue_test_wordcount()
         {
         wp_enqueue_script( 'word-count' );
         }

 add_action("wp_enqueue_scripts","frontier_enqueue_test_wordcount");
 ?>
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34230>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list