Forum Replies Created
-
AuthorPosts
-
Studio Hirilo
ParticipantHello!
I found the issue!!! π
It turns out my search instance was using the index table engine… All I had to do was switch to the regular engine, and… miracle, the code worked!!!Thank you once again for your valuable assistance.
I wish you all the best!
ByeStudio Hirilo
ParticipantDarn… it still doesn’t work… π
Studio Hirilo
ParticipantHello,
Thank you for this modification! I finally had time to test this code in Code Snippet. Unfortunately, it doesn’t seem to work for meβ¦ I’m sorry, I’m really not proficient in PHP and I usually manage to figure things out on my ownβ¦ but not this time! πCould you please take another look? Here is the modified code:
add_filter("asp_query_args", "asp_query_args_change", 10, 2); function asp_query_args_change($args, $search_id) { if ( $search_id == 1 ) { $include_ids = array(1954, 1955, 1956, 1957, 1958); // Media file IDS to include // No change below $ids = implode(', ', $include_ids); $args['attachment_query']['where'] = "AND $wpdb->posts.ID IN($ids)"; return $args; } }I didn’t change the ID of $search_id because I’m testing it with the first search instance I created, and I only modified the list of media IDs. I don’t see what could be wrong…
I cleared all caches to make sure, but nothing seems to work.
I created the code in Code Snippet as PHP code, allowing it to be active everywhere on the site…Thank you for assisting me!
Have a nice day ! πStudio Hirilo
ParticipantHello !
Thank you very much for your prompt response. I will try that with Code Snippet. I just have one thing I forgot to mention, oops: I will create multiple search instances, and each one should include different files IDs. How can I associate each specific code with the different instances? Thank you for your answers!
See you soon. -
AuthorPosts