Page::get_link_to_edit_posts()
Get the link to edit posts.
Return
(string)
Source
File: src/Tickets/Admin/Tickets/Page.php
public function get_link_to_edit_posts() {
// Get array of enabled post types.
$post_types = Tribe__Tickets__Main::instance()->post_types();
$not_set = empty( $post_types );
$has_tec = did_action( 'tribe_events_bound_implementations' );
if ( $has_tec && ( in_array( 'tribe_events', $post_types, true ) || $not_set ) ) {
// If TEC is installed and the event post type is enabled or post types are not set, return the event post type.
$post_type = Tribe__Events__Main::POSTTYPE;
} elseif ( in_array( 'page', $post_types, true ) || empty( $post_types ) ) {
// If the page post type is enabled or post types are not set, return the page post type.
$post_type = 'page';
} else {
// Otherwise, return the first post type in the array.
$post_type = $post_types[0];
}
// Create link to edit posts page.
return add_query_arg( [ 'post_type' => $post_type ], admin_url( 'edit.php' ) );
}
Changelog
| Version | Description |
|---|---|
| 5.14.0 | Introduced. |