Forums Forums Search & Filter Pro Search by Post Title

Tagged: , ,

Viewing 8 posts - 1 through 8 (of 8 total)
  • Trevor
    #227343
    This reply has been marked as private.
    Anonymous
    #227362
    This reply has been marked as private.
    Trevor
    #227373
    This reply has been marked as private.
    Anonymous
    #227393
    This reply has been marked as private.
    Anonymous
    #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
    #227403

    Ah. 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:

    https://www.google.com/search?q=functions.php+save_post+copy+post+title+to+custom+field+site:wordpress.stackexchange.com

    But, the answers show how to copy the opposite way, but the logic can be reversed.

    Anonymous
    #227467

    That was the problem you were right. It’s all fixed now, you can mark this as resolved.

    Being able to do this with the click of a button would be a great feature for this plugin. A search by title feature.

    Thanks a lot for your help.

    Trevor
    #227473

    I believe it will be possible in V3. Thanks for letting me know. I will close this thread for now.

Viewing 8 posts - 1 through 8 (of 8 total)