• Resolved kannupriya

    (@kannupriya)


    I want to show searching on the base of my advanced custom fields.
    In settings there is no options, I have checked the link:
    https://www.secretsofgeeks.com/2014/09/wordpress-search-tags-and-categories.html

    and implemented hook in function.php i.e.

    wpes_meta_keys_query
    Filter SQL query for listing meta keys in plugin settings.

    /**
    * Select all meta keys including those start with _(underscore)
    */
    function wpes_meta_keys_query($query) {
    global $wpdb;
    $query = “select DISTINCT meta_key from $wpdb->postmeta ORDER BY meta_key ASC”;
    return $query;
    }
    add_filter(‘wpes_meta_keys_query’, ‘wpes_meta_keys_query’);

    but didnot get any option to select in the settings
    Please guide how to search on the base of ACF.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Sumit Singh

    (@5um17)

    Hi,

    Please make sure you’ve added that code to theme functions.php and you have meta keys in the database.
    If still doesn’t work then provide me screenshot of WPES setting and post meta table.

    Thanks

    Thread Starter kannupriya

    (@kannupriya)

    Hi,
    Thanks for the respond, I have added script in function.php for meta keys in settings but still not showing settings, I am sharing the snapshot of:

    1.) function.php where I added the script/code
    2.) settings page
    3.) wp_postmeta table snapshot

    https://ibb.co/zbC9m27
    https://ibb.co/rGV7PpM
    https://ibb.co/q15WvC9

    Please confirm Where I missed the things.

    Thread Starter kannupriya

    (@kannupriya)

    I read document again and noticed line: ”

    Meta keys, which starts with (_) underscore, are not available to select, as these are WordPress default Meta keys which do not have humans readable values.”

    https://ibb.co/C79XJy0

    please check fields I highlighted stored as underscore ‘_’ and without underscore which keeps the value of custom field. Is this the reason, settings not coming. But What I noticed while refreshing the setting page sometimes meta shows.

    Plugin Author Sumit Singh

    (@5um17)

    Hi,

    This is unexpected. Even if there is problem in query or there is no custom field then at least that meta box heading should be there. I think there is some conflict with other plugin or theme.

    Please check if you disable all plugins except WPES and switch to default theme e.g. Twenty Nineteen then still do you see the issue?
    Also, check for error logs.

    Thread Starter kannupriya

    (@kannupriya)

    It works like a charm for me , I used this hook
    add_filter(‘wpes_meta_keys’, ‘wpes_meta_keys’);
    and showing select meta key values in settings.

    • This reply was modified 5 years, 5 months ago by kannupriya.
    Thread Starter kannupriya

    (@kannupriya)

    https://ibb.co/378ynJp
    check showing an option

    Plugin Author Sumit Singh

    (@5um17)

    This hook add_filter(‘wpes_meta_keys’, ‘wpes_meta_keys’); is to insert some selected meta keys. Not sure how you are using it.
    So the issue is resolved?

    Thread Starter kannupriya

    (@kannupriya)

    yes. as per snapshot I shared displayed options but while search , response through 504 gateway timeout error ??

    Plugin Author Sumit Singh

    (@5um17)

    You have selected too many fields resulting in very long query thus your server is exhausted.
    Please only selected what is needed.

    Thread Starter kannupriya

    (@kannupriya)

    my requirement is company_info_0_compnay_name
    in the meta key, number can vary its base on the add more rows to add number of companies

    Plugin Author Sumit Singh

    (@5um17)

    Then contact ACF that how you can save data in one key in serialized array format or ask host to fix 504 error.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Advanced custom fields searching not working’ is closed to new replies.