File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -336,3 +336,28 @@ function wpum_remove_slashes_from_field_data( $field_name ) {
336336
337337add_filter ( 'wpum_field_name ' , 'wpum_remove_slashes_from_field_data ' );
338338add_filter ( 'wpum_field_description ' , 'wpum_remove_slashes_from_field_data ' );
339+
340+ /**
341+ * In WP 6.0+, virtual pages for our Account and Profile subpages (eg. account/posts or profile/comments)
342+ * no longer inherit the page template of the parent page. This fixes that.
343+ */
344+ add_filter ( 'template_include ' , function ( $ template ) {
345+ global $ wp ;
346+
347+ if ( ! isset ( $ wp ->query_vars ) ) {
348+ return $ template ;
349+ }
350+
351+ if ( ! isset ( $ wp ->query_vars ['page_id ' ] ) ) {
352+ return $ template ;
353+ }
354+
355+ if ( $ wp ->query_vars ['page_id ' ] === wpum_get_core_page_id ( 'account ' ) || $ wp ->query_vars ['page_id ' ] === wpum_get_core_page_id ( 'profile ' ) ) {
356+ $ new_template_slug = get_page_template_slug ( $ wp ->query_vars ['page_id ' ] );
357+ if ( $ new_template_slug && basename ( $ template ) !== $ new_template_slug ) {
358+ $ template = dirname ( $ template ) . '/ ' . $ new_template_slug ;
359+ }
360+ }
361+
362+ return $ template ;
363+ }, 100 );
You can’t perform that action at this time.
0 commit comments