inserting content of 1 Post to in another with a template hierarchy

Yes, get_page_by_path() will return a post object or array on success, and not the post ID. $faq_post = get_page_by_path( $post_slug, OBJECT, ‘land’ ); // object $faq_post = get_page_by_path( $post_slug, ARRAY_A, ‘land’ ); // array So there is no need to make the custom new WP_Query call, and your code below is good: $faq_post = get_page_by_path( … Read more

Restricting page templates by blog_id in multisite network

I know it is a bit old question. But I hope some one can find it usefull. If for some reason you can’t use child-theme (like me) there is hook theme_page_templates Accordint to developer WP Page Templates. Example: function makewp_exclude_page_templates( $post_templates ) { if ( is_multisite() && !is_main_site() ) { unset( $post_templates[‘wp-templates/iframe_container.php’] ); //In my … Read more

understanding theme hierarchy

Your understanding is incorrect. That’s not how WordPress works, and that documentation is not saying what you describe. The hierarchy rules tell you what template is used when you view content types created in WordPress, such as Pages and Posts. If you create a page called “Test” in Pages > Add New, then when you … Read more

Use different template than author.php for get_author_posts_url()

There is a filter called author_link. You can use that change the URL to whatever you want. add_filter( ‘author_link’, function ($link, $author_id, $author_nicename) { var_dump($link, $author_id, $author_nicename); // debug return $link; // return your modified URL }, 1,3 ); The question does not have enough detail to allow for more specific code. You can use … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)