
Definition
In WordPress, wp_meta() fires the wp_meta action hook. It is called inside the "Meta" list of the sidebar, right after the login and feed links.
Themes call wp_meta() so that plugins can add their own list items there with add_action( 'wp_meta', ... ).
Syntax
Call it inside the Meta list, after your other links.
<ul>
<?php wp_register(); ?>
<li><?php wp_loginout(); ?></li>
<?php wp_meta(); ?>
</ul>
| Call | What it does |
|---|
wp_meta() | Runs the hook so plugins can add list items. |
add_action( 'wp_meta', 'my_function' ) | Add your own item to the list. |
wp_register() | Prints the Register or Site Admin link. |
It does not print anything by itself. It only runs the hooked functions.
Full declaration
Parameters
| Parameter | Description |
|---|
| None | This function takes no parameters. |
Return Value
| Return Value | Description |
|---|
| void | Nothing is returned. Hooked functions may print HTML. |
WordPress Examples
Three short theme examples. Each one shows the code and what it prints.
Example 1 — A Meta list
Build a classic Meta box in a sidebar.
<h3>Meta</h3>
<ul>
<?php wp_register(); ?>
<li><?php wp_loginout(); ?></li>
<?php wp_meta(); ?>
</ul>
<h3>Meta</h3>
<ul>
<li><a href="https://example.com/wp-admin/">Site Admin</a></li>
<li><a href="https://example.com/wp-login.php?action=logout&_wpnonce=abc123">Log out</a></li>
</ul>
How It Works
wp_register() prints the Register or Site Admin item.wp_loginout() prints Log in or Log out.wp_meta() lets plugins add more items at the end.
Example 2 — Add your own item
Use the hook to add a link.
<?php
add_action( 'wp_meta', function () {
echo '<li><a href="' . esc_url( home_url( '/sitemap/' ) ) . '">Sitemap</a></li>';
} );
<ul>
...
<li><a href="https://example.com/sitemap/">Sitemap</a></li>
</ul>
How It Works
add_action( 'wp_meta', ... ) attaches our function.- When
wp_meta() runs, our list item is printed. - The new link appears at the end of the Meta list.
Example 3 — Without any hook
See what happens when nothing is attached.
<ul>
<li>Home</li>
<?php wp_meta(); ?>
</ul>
How It Works
- No function is hooked to
wp_meta. wp_meta() prints nothing.- It is safe to leave in your theme.
Frequently Asked Questions
It runs the wp_meta action so plugins can add list items to the Meta section of the sidebar.
Not by itself. It prints only what functions hooked to wp_meta print.
Inside the Meta list in your sidebar, after the login and register links.
No, but including it lets plugins add their links to your theme.
About the author
Developer, cloud engineer, and technical writer
I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.
11 people found this page helpful