Forum Replies Created
-
AuthorPosts
-
milena_u6jm
ParticipantYou cannot access this content.
milena_u6jm
ParticipantYou cannot access this content.
April 29, 2026 at 12:40 am in reply to: Price filters – Range Slider – Not working as expected #57370milena_u6jm
ParticipantThanks Ernest!
April 24, 2026 at 2:19 pm in reply to: Price filters – Range Slider – Not working as expected #57352milena_u6jm
ParticipantResults are pouring in as expected, thank you.
Got one (hopefully) last bug….
There are some artists that are showing up in the artist filter list even though they now have no artworks. The ASP setting seems fine to hide artists with no posts, but its still not working as expected…. If you load the page and select Paul Davies, he’s got no works, but still show up in the filter list.Any ideas to make him disappear?
Thanks Ernest!!!
-
This reply was modified 2 months, 4 weeks ago by
milena_u6jm.
milena_u6jm
ParticipantYou cannot access this content.
milena_u6jm
ParticipantYou cannot access this content.
milena_u6jm
ParticipantPrivate details are listed here, thanks:
https://wp-dreams.com/forums/topic/setting-up-pre-filters-for-an-index/milena_u6jm
ParticipantHey Ernest!
Thanks for that info.
We are trying to work with the “Latest Results” option. However, after adding some new media that is defintely “newer” as far as the uploaded date goes, we noticed that the index wasnt showing these items first. I confirmed that the item is in the index if I search for its title. And then I changed the option to “Random Results” and saved, but I still get the same results as before, so something is a bit buggy..
Have we got a setting wrong in there somewhere that I should check?
Please let me know.
milena_u6jm
ParticipantDo you think this might work for our needs?
/** * Limit ASP index to attachments that meet availability criteria. */ // 1. Block indexing on initial save if criteria not met add_filter( 'asp_index_on_save_stop', function ( $stop, $post_id, $_post, $update ) { if ( get_post_type( $post_id ) !== 'attachment' ) { return $stop; } $available = get_post_meta( $post_id, 'available', true ); $web_status = get_post_meta( $post_id, 'web_status', true ); if ( $available != 1 || ! in_array( $web_status, [ 'Available', 'Under Consideration' ], true ) ) { return true; // stop indexing } return $stop; }, 10, 4 ); // 2. When either relevant meta key is updated, check if the item // now meets full criteria and re-index (or remove) accordingly. // Uses ASP's IndexTable API directly add_action( 'updated_post_meta', function ( $meta_id, $post_id, $meta_key ) { if ( ! in_array( $meta_key, [ 'available', 'web_status' ], true ) ) { return; } if ( get_post_type( $post_id ) !== 'attachment' ) { return; } $available = get_post_meta( $post_id, 'available', true ); $web_status = get_post_meta( $post_id, 'web_status', true ); $index_table = \WPDRMS\ASP\Hooks\Actions\IndexTable::getInstance(); if ( $available == 1 && in_array( $web_status, [ 'Available', 'Under Consideration' ], true ) ) { // Criteria met — add/update in index $index_table->update( $post_id, null, true ); } else { // Criteria no longer met — remove from index $index_table->delete( $post_id ); } }, 10, 3 );-
This reply was modified 4 months, 2 weeks ago by
milena_u6jm.
milena_u6jm
ParticipantYou cannot access this content.
milena_u6jm
ParticipantHey Ernest,
So an update on this one, generally, this is working as expected for existing media items, so thanks!!
I have modified this to also add a second acf field that also has to be there else no index. What I have noticed though, was some new media items were showing in the index when they didnt have those flags selected. I will add, we add these media items via the rest API, I wondering if there’s some funny timing things happening? I think with the rest scripts, the initial item is added, then we do a second pass to add the acf values, not sure if relevant, but thought I would add that detail. Let me know what you think.
add_filter( 'asp/index/database/get_posts_to_index/query/add_where', function ( $add_where ) { global $wpdb; return $add_where . " AND ( ( post.post_type='attachment' AND EXISTS( SELECT 1 FROM $wpdb->postmeta pm1 WHERE pm1.post_id=post.ID AND pm1.meta_key='available' AND pm1.meta_value=1 ) AND EXISTS( SELECT 1 FROM $wpdb->postmeta pm2 WHERE pm2.post_id=post.ID AND pm2.meta_key='web_status' AND pm2.meta_value IN ('Available', 'Under Consideration') )) OR post.post_type <> 'attachment' )"; } );milena_u6jm
ParticipantYou cannot access this content.
milena_u6jm
ParticipantThanks Ernest, that worked a treat!
Appreciate the effort.
milena_u6jm
ParticipantOK, can you please let me know, really need to get this one completed ASAP. Thanks Ernest.
milena_u6jm
ParticipantGreat, that solved the WebP part, thanks!
But still hitting limits….
Upon more investigation, I believe the issue is the asp_index_ignore is just too large as is hitting the max packet limit of 16mb. I have contacted the host, but they wont increase this over 16mb, which seems to be a standard security level. We are indexing 5500 items. Does that sound right to you?
Is there another way to pre-filter the index that doesnt include the creation of the ignore list?
-
This reply was modified 2 months, 4 weeks ago by
-
AuthorPosts