Forums › Forums › Search & Filter Pro › Search by Post Title
Tagged: acf, post titles, V3
- This topic has 8 replies, 2 voices, and was last updated 5 years, 11 months ago by
Trevor.
-
Anonymous(Private) November 22, 2019 at 3:22 pm #227395
In case it helps, the way the ACF field populates the Title is with a shortcode I created in functions.php:
function mcl_get_title(){ global $wp_query; return get_the_title($wp_query->post->ID); } add_shortcode('postTitle', 'mcl_get_title');So I have added the shortcode
[postTitle]as default value in the field and I am expecting it to store the title as meta. It works on the front end. When I add the shortcode in a post it renders the post title.Eventually once everything works I will hide the ACF metabox (seamless) so that the cient doesn’t mess up anything.
Trevor(Private) November 22, 2019 at 3:39 pm #227403Ah. That will be why it isn’t working. Instead, you need to have code in the functions.php based on the WordPress save_post() function that copies the title into that post meta field.
The search looks for what you want:
But, the answers show how to copy the opposite way, but the logic can be reversed.
-
AuthorPosts