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

Custom page for editing custom post type on frontend based on url

You can add custom url structures with add_rewrite_rule for example the proposed structure in your question can be achieved with something like… add_action( ‘init’, function() { add_rewrite_rule( ‘^jobs/([^/]+)/edit/?$’, ‘index.php?post_type=jobs&name=$matches[1]’, ‘top’ ); } ); So now if you visited https://example.com/jobs/job-title-example/edit/ you should see exactly the same as if you were to visit https://example.com/jobs/job-title-example/ this is because … Read more

wp_get_canonical_url showing first url of the post for custom page

This is because wp_get_canonical_url can only be used on posts, and cannot be used for tags authors archives etc. Returns the canonical URL for a post. https://developer.wordpress.org/reference/functions/wp_get_canonical_url/ More specifically, no equivalent exists for tag archives because archives and listings do not have canonical URLs. A canonical URL indicates to a search engine the correct and … Read more

get_avatar() as backround image

It’s hard to say exactly what the problem is with your code, but… There is at least one major flaw – you don’t pass any param to get_avatar_url, but first param for that function is required and should contain ID or email. To be precise: $id_or_email (mixed) (Required) The Gravatar to retrieve a URL for. … Read more

Display ACF if parent page has specific template

For anyone dealing with the same issue, I just needed to change: $choices[ $template_name ] = $template_name; with: $choices[ $template_filename ] = $template_name; Consider a page template Homepage (page-home.php). This way the template name Homepage will appear on the custom fields page but $rule[‘value’] will actually return page-home.php and then we can compare this with … Read more

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