Support

Account

Forum Replies Created

  • The problem was solved after examining my code again. I’ve worked with a custom table in the past. Due to difficulties I had retrieved the fields with post_name (‘field_5f4005dc755c5’) and not with the field name (‘deathdate’). I have now re-saved the posts. After saving, I could now retrieve the field values with the field name again, and now the custom fields appear in the taxonomy output! Although I don’t know why it was related to the URL parameter, everything works now. Please excuse the confusion ๐Ÿ˜‰

  • Please don’t let the different spellings of the parameters confuse you, I forgot to unify them when translating, sorry ๐Ÿ˜‰

  • Hi John,
    thank you so much for the many suggestions!!!

    That sounds really interesting and I’m sure to solve the problem now ๐Ÿ™‚

  • In the meantime I found these statements:

    – Using meta queries to find posts is super expensive
    – Post meta isn’t built for filtering
    – Taxonomies were built for filtering, and they’re significantly faster for this
    – Post meta is designed for when you already know which posts, so get_post_meta is a fast function

    Someone suggested, to read out all entries with get_posts without filtering, and then do an extra loop with this output, to filter the entries.

    Is this really the only solution? And if so, could anyone help me to do this?

  • I’m working on a relaunch of my old website. In the old website I read the data โ€‹โ€‹of the people with SQL directly from a mysql database (with a cache plugin). Here’s an example of a similar query, I did in the old website, to output 4 persons at the end of the page:

    SELECT id, name, image, birthday, url, imageurl, license, author FROM Persons WHERE Day(birthday) = '{$birthday}' AND Month(birthday) = '{$month}' AND id != '{$id}' ORDER BY RAND() LIMIT 4

    The charging time is only 0.007 seconds (!) in contrast to over 1 second, when I do the query with get_posts and custom fields as shown above.

    I can’t understand this, what am I doing wrong ๐Ÿ™

  • Edit: I also tried to use ACF JSON, but without success. I’ve created a directory named acf-json, and after saving the field-group a new file was written to the directory. But there was no time-improvement, and the number of queries didn’t decrease.

  • I solved the problem myself using a variable and REGEX ๐Ÿ˜‰

     'meta_query' => array(
                        array(
                          'key'      => 'birthday',
                          'compare'  => 'REGEXP',
                          'value'    => $year.'[0-9]{2}[0-9]{2}', 
                        ),    
                      )
    ));
Viewing 7 posts - 1 through 7 (of 7 total)