WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 8 months ago

#42927 closed enhancement (duplicate)

Introduce the wp_body() function that fires the `wp_body` action

Reported by: ramiy Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Themes Keywords:
Focuses: Cc:
PR Number:

Description

When we want to add scripts & styles on the frontend, we can hook either to the wp_head action or to the wp_footer action.

The wp_head() function introduced in WordPress 1.2.0, it fires the wp_head action hook that adds data to the <head> tag.

The wp_footer() function introduced in WordPress 1.5.1, it fires the wp_footer action hook that adds data to the end of the <body> tag.

Currently we can't add data to the beginning of the <body> tag. WordPress should have a way to allow developers to add data to the beginning of the body.

<html>
  <head>

    ..
    ..

    <?php wp_head(); ?>

  </head>
  <body>

    <?php wp_body(); ?>

    ..
    ..

    <?php wp_footer(); ?>

  </body>
</html>

It's a good improvement for WordPress 5.0.

Attachments (1)

42927.patch (574 bytes) - added by ramiy 2 years ago.

Download all attachments as: .zip

Change History (4)

@ramiy
2 years ago

#1 @birgire
2 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Many think this is useful.

I found another ticket #12563 already discussing this, so I mark this as a duplicate.

Hopefully you can join that ticket instead.

#2 @dd32
23 months ago

  • Milestone Awaiting Review deleted

#3 @ramiy
8 months ago

Fixed in changeset 45042

Note: See TracTickets for help on using tickets.