You are missing the second parameter in get_page_by_title
. See get_page_by_title() reference. When you are testing without explicitly specified $output
and $post_type
, this function returns the post of type ‘page’ object by default. So you have to return $page->post_parent
for patient’s parent page ID:
add_filter('gform_field_value_parent_id', 'parent_id');
function parent_id() {
// three parameters here
$page = get_page_by_title('TESTID', 'OBJECT', 'patient');
// return patient's parent page ID
if( !is_null($page) )
return $page->post_parent;
}
P. S. It’s a good practice to enable WP_DEBUG
in wp-config.php
to see all errors and warnings during development stage. Often it helps to understand bottlenecks faster.
Related Posts:
- Limit the word count in the post title
- how to display posts content on the custom css popup by clicking on each title on the sidebar?
- Change “Enter Title Here” help text on a custom post type
- Submit post and upload image from front-end
- Linking Two Post Types
- Pull Two Posts Into Custom Post Type `single-cpt.php`
- Problem excluding category from get_next_post
- Why is the »_builtin« parameter not advised in »register_post_type()« for custom post types?
- How to let custom post type posts show in standard post archive (like in homepage)?
- Rewrite custom post & taxonomy to share same URL path
- How do I write this SQL statement for Posts written in last 24 hours?
- Search Post Title Only [duplicate]
- Change Post Title Edit Box
- How do you use JavaScript to detect the homepage
- Multiple information using custom post type
- Disable feeds for specific custom post types
- Disabling post_type in URL
- Before Delete Post
- Making pages also serve as taxonomies? Or give full pages to taxonomies?
- Why does using WP_Query inside a shortcode in an elementor page cause the arguments for WP_Query to get malformed?
- Check Title Unique Or Not and If not error message and dont save
- I am having a problem with form updating/editing WordPress post on the frontend
- How to filter the taxonomy terms based on another taxonomy term
- Why my custom post posts aren’t showing (404 error / page not found)
- Automaticly add slug to posts
- apply filters only to specific post listing without check the url parameters
- Shortcode for display posts on home page show only one post
- How to Separate CPT From Regular Posts?
- Remove rows in the manage post/page view
- Display only one post each WEEK
- Post image in WordPress not appearing on home page
- How to add a custom-post-type post within another custom-post-type post edit screen using AJAX?
- Set a checkmark in a category based on a URL-parameter
- Portfolio Page for Classic Posts
- Limit the post for differents custom post type in the same wp_query
- Custom Meta Title for Custom Post Type
- How can i create an custom post template for an specific post category? [closed]
- WP the_posts() on single-cars.php get category link
- how to check if custom post title exists or not?
- Modify previous and next post links to current Authors Other posts
- Display an authors post on a single page only when they are logged in
- Get_the_terms restrict output
- Address as a content type post
- Query within a foreach within a query (queryception)
- How to implement a different permalink structure for custom post type?
- Generate new post from email
- YOAST SEO won’t work on custom post type archive [closed]
- Batch Extract Date from post title and put into ACF custom field
- How to add new post using a form to categories when categories are using as menu
- Custom wordpress loop
- Different post title, keywords and description
- how to get options to choose post format in add new post
- How to populate a Gravity Forms Custom Post Field (dropdown type) with custom taxonomy terms? [closed]
- Render a Post or Page using the correct file
- WordPress Count posts within a custom post type
- Use post in multiple places on a page with multiple posts
- Custom post type tags not showing in search
- Add the custom post term to the custom post title
- Making a form for user to add new custom post with custom taxonomies and custom fields
- Custom post type filter is being applied to all of my posts
- Admin slow on Postlist (over 30k Posts in Database)
- Get_post_custom not fetching value from array wordpress
- Display Parent-Child Posts in specific order by comparing IDs in array
- Post category behave like a Post in back office menu
- Save data is post using php front end
- What is the best way to structure posts for the same event happening in different years?
- How to display custom field in product description?
- How to display posts with plugin (advanced custom fields) field groups?
- WordPress – display relationship between blog posts and custom posts
- Custom page with no headers, footers and its own CSS, Javascript
- SEARCH QUERIES – REVERSE OUTPUT
- Is there a way to create a sidebar of bullets
- Get queried object for custom post type count
- edit.php all post not working
- Dynamically Adding Posts of Post Type to A List
- I cannot display custom posts in custom taxonomy
- How can I get the last 5 element of this tax query?
- Using Orderby and meta_value to order natural/alphanumerical
- filter the title changed also the page titles
- How to get the posts that my following users are liked?
- How to insert post 6 times after user register like ask.fm
- How can i order my posts by post type?
- Creating custom post type relationships
- How to mark posts as visited
- creating a custom post template
- How To Loop Through list with Custom Post Types
- Adding Information To All Posts Screen
- how to edit custom fields of type gallery from front-end
- Different post types arranged on one page
- erase post excerpt limitation [×]
- Post Editor: display categories from current post type taxonomy only?
- Display all post types together
- Pulling in a particular post into a single page based on the post id passed into the code
- Custom My account page and custom page for editing posts
- Can a user drop a HTML Shadow DOM into a blog post?
- show only one category posts in admin
- Get post from custom post type that title is like custom string [closed]
- show posts under custom post type with same autj
- Custom post type split title, setup permalink accordingly
- Two pagination in one page without AJAX