Opened 5 years ago
Last modified 5 years ago
#53346 new defect (bug)
get_permalink( $post->ID ) returns plain permalink instead of pretty permalink for CPT registered on subsite
| Reported by: | 1theo | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Permalinks | Version: | 5.7 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: | multisite |
Description (last modified by )
I have a multisite network with CPTs that are registered individually by subsite.
The main site provides an overview of these, using
get_permalink( $post->ID );
to link to the pretty permalink location in each subsite.
After the introduction of
wp_force_plain_post_permalink()
in WP 5.7.0
get_permalink() returns plain permalinks due to failing to pass the test in wp_force_plain_post_permalink():
$post_type_obj = get_post_type_object( get_post_type( $post ) );
get_post_type_object() returns null, as the CPT is not present in the global $wp_post_types of the main site (even after trying switch_to_blog( $post->blog_id );
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)