File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -2567,17 +2567,22 @@ function the_block_editor_meta_box_post_form_hidden_fields( $post ) {
25672567 do_action ( 'edit_form_advanced ' , $ post );
25682568 $ classic_output = ob_get_clean ();
25692569
2570- $ classic_elements = wp_html_split ( $ classic_output );
2571- $ hidden_inputs = '' ;
2572- foreach ( $ classic_elements as $ element ) {
2573- if ( ! str_starts_with ( $ element , '<input ' ) ) {
2574- continue ;
2570+ $ processor = new class ( $ classic_output ) extends WP_HTML_Tag_Processor {
2571+ public function extract_raw_token () {
2572+ $ this ->set_bookmark ( 'here ' );
2573+ $ here = $ this ->bookmarks ['here ' ];
2574+
2575+ return substr ( $ this ->html , $ here ->start , $ here ->length );
25752576 }
2577+ };
25762578
2577- if ( preg_match ( '/\stype=[ \'"]hidden[ \'"]\s/ ' , $ element ) ) {
2578- echo $ element ;
2579+ while ( $ processor ->next_tag ( 'INPUT ' ) ) {
2580+ if ( 'hidden ' === $ processor ->get_attribute ( 'type ' ) ) {
2581+ echo $ processor ->extract_raw_token ();
25792582 }
25802583 }
2584+
2585+ $ hidden_inputs = '' ;
25812586 ?>
25822587 <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int ) $ user_id ; ?> " />
25832588 <input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr ( $ form_action ); ?> " />
You can’t perform that action at this time.
0 commit comments