On this page
get_post_format_link( string $format ): string|WP_Error|false
Returns a link to a post format index.
Parameters
$formatstring Required-
The post format slug.
Return
string|WP_Error|false The post format term link.
Source
File: wp-includes/post-formats.php. View all references
function get_post_format_link( $format ) {
$term = get_term_by( 'slug', 'post-format-' . $format, 'post_format' );
if ( ! $term || is_wp_error( $term ) ) {
return false;
}
return get_term_link( $term );
}
Related
Uses
| Uses | Description |
|---|---|
| get_term_link() wp-includes/taxonomy.php | Generates a permalink for a taxonomy term archive. |
| get_term_by() wp-includes/taxonomy.php | Gets all term data from database by term field and data. |
| is_wp_error() wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
Used By
| Used By | Description |
|---|---|
| WP_REST_Post_Format_Search_Handler::search_items() wp-includes/rest-api/search/class-wp-rest-post-format-search-handler.php | Searches the object type content for a given search request. |
| WP_REST_Post_Format_Search_Handler::prepare_item() wp-includes/rest-api/search/class-wp-rest-post-format-search-handler.php | Prepares the search result for a given ID. |
Changelog
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_post_format_link