Title: WP_HTML_Processor::step_after_after_body
Published: February 24, 2026

---

# WP_HTML_Processor::step_after_after_body(): bool

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_html_processor/step_after_after_body/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/classes/wp_html_processor/step_after_after_body/?output_format=md#see-also)
 * [Return](https://developer.wordpress.org/reference/classes/wp_html_processor/step_after_after_body/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_html_processor/step_after_after_body/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_html_processor/step_after_after_body/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_html_processor/step_after_after_body/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_html_processor/step_after_after_body/?output_format=md#wp--skip-link--target)

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

Parses next element in the ‘after after body’ insertion mode.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_html_processor/step_after_after_body/?output_format=md#description)󠁿

This internal function performs the ‘after after body’ insertion mode logic for 
the generalized [WP_HTML_Processor::step()](https://developer.wordpress.org/reference/classes/wp_html_processor/step/)
function.

### 󠀁[See also](https://developer.wordpress.org/reference/classes/wp_html_processor/step_after_after_body/?output_format=md#see-also)󠁿

 * [https://html.spec.whatwg.org/#the-after-after-body-insertion-mode](https://html.spec.whatwg.org/#the-after-after-body-insertion-mode/)
 * [WP_HTML_Processor::step](https://developer.wordpress.org/reference/classes/WP_HTML_Processor/step/)

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_html_processor/step_after_after_body/?output_format=md#return)󠁿

 bool Whether an element was found.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_html_processor/step_after_after_body/?output_format=md#source)󠁿

    ```php
    private function step_after_after_body(): bool {
    	$tag_name   = $this->get_token_name();
    	$token_type = $this->get_token_type();
    	$op_sigil   = '#tag' === $token_type ? ( $this->is_tag_closer() ? '-' : '+' ) : '';
    	$op         = "{$op_sigil}{$tag_name}";

    	switch ( $op ) {
    		/*
    		 * > A comment token
    		 */
    		case '#comment':
    		case '#funky-comment':
    		case '#presumptuous-tag':
    			$this->bail( 'Content outside of HTML is unsupported.' );
    			break;

    		/*
    		 * > A DOCTYPE token
    		 * > A start tag whose tag name is "html"
    		 *
    		 * > Process the token using the rules for the "in body" insertion mode.
    		 */
    		case 'html':
    		case '+HTML':
    			return $this->step_in_body();

    		/*
    		 * > A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF),
    		 * >   U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE
    		 * >
    		 * > Process the token using the rules for the "in body" insertion mode.
    		 */
    		case '#text':
    			if ( parent::TEXT_IS_WHITESPACE === $this->text_node_classification ) {
    				return $this->step_in_body();
    			}
    			goto after_after_body_anything_else;
    			break;
    	}

    	/*
    	 * > Parse error. Switch the insertion mode to "in body" and reprocess the token.
    	 */
    	after_after_body_anything_else:
    	$this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_IN_BODY;
    	return $this->step( self::REPROCESS_CURRENT_NODE );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/html-api/class-wp-html-processor.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/html-api/class-wp-html-processor.php#L4658)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/html-api/class-wp-html-processor.php#L4658-L4704)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_html_processor/step_after_after_body/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_HTML_Processor::bail()](https://developer.wordpress.org/reference/classes/wp_html_processor/bail/)`wp-includes/html-api/class-wp-html-processor.php` |

Stops the parser and terminates its execution when encountering unsupported markup.

  | 
| [WP_HTML_Processor::get_token_name()](https://developer.wordpress.org/reference/classes/wp_html_processor/get_token_name/)`wp-includes/html-api/class-wp-html-processor.php` |

Returns the node name represented by the token.

  | 
| [WP_HTML_Processor::get_token_type()](https://developer.wordpress.org/reference/classes/wp_html_processor/get_token_type/)`wp-includes/html-api/class-wp-html-processor.php` |

Indicates the kind of matched token, if any.

  | 
| [WP_HTML_Processor::is_tag_closer()](https://developer.wordpress.org/reference/classes/wp_html_processor/is_tag_closer/)`wp-includes/html-api/class-wp-html-processor.php` |

Indicates if the current tag token is a tag closer.

  | 
| [WP_HTML_Processor::step_in_body()](https://developer.wordpress.org/reference/classes/wp_html_processor/step_in_body/)`wp-includes/html-api/class-wp-html-processor.php` |

Parses next element in the ‘in body’ insertion mode.

  | 
| [WP_HTML_Processor::step()](https://developer.wordpress.org/reference/classes/wp_html_processor/step/)`wp-includes/html-api/class-wp-html-processor.php` |

Steps through the HTML document and stop at the next tag, if any.

  |

[Show 1 more](https://developer.wordpress.org/reference/classes/wp_html_processor/step_after_after_body/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_html_processor/step_after_after_body/?output_format=md#)

| Used by | Description | 
| [WP_HTML_Processor::step_in_foreign_content()](https://developer.wordpress.org/reference/classes/wp_html_processor/step_in_foreign_content/)`wp-includes/html-api/class-wp-html-processor.php` |

Parses next element in the ‘in foreign content’ insertion mode.

  | 
| [WP_HTML_Processor::step()](https://developer.wordpress.org/reference/classes/wp_html_processor/step/)`wp-includes/html-api/class-wp-html-processor.php` |

Steps through the HTML document and stop at the next tag, if any.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_html_processor/step_after_after_body/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.7.0](https://developer.wordpress.org/reference/since/6.7.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_html_processor%2Fstep_after_after_body%2F)
before being able to contribute a note or feedback.