Title: Tristan's Replies | WordPress.org

---

# Tristan

  [  ](https://wordpress.org/support/users/tristanmsg/)

 *   [Profile](https://wordpress.org/support/users/tristanmsg/)
 *   [Topics Started](https://wordpress.org/support/users/tristanmsg/topics/)
 *   [Replies Created](https://wordpress.org/support/users/tristanmsg/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/tristanmsg/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/tristanmsg/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/tristanmsg/engagements/)
 *   [Favorites](https://wordpress.org/support/users/tristanmsg/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 19 total)

1 [2](https://wordpress.org/support/users/tristanmsg/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/tristanmsg/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Ajax Load More – Infinite Scroll, Load More, & Lazy Load] Custom argument not defined in ‘alm_query_args_{id}’ hook](https://wordpress.org/support/topic/custom-argument-not-defined-in-alm_query_args_id-hook/)
 *  Thread Starter [Tristan](https://wordpress.org/support/users/tristanmsg/)
 * (@tristanmsg)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/custom-argument-not-defined-in-alm_query_args_id-hook/#post-16956563)
 * That seems to have fixed it – thanks!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Super Cache] Compatibility with PHP 8.1](https://wordpress.org/support/topic/compatibility-with-php-8-1-7/)
 *  [Tristan](https://wordpress.org/support/users/tristanmsg/)
 * (@tristanmsg)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/compatibility-with-php-8-1-7/#post-16926772)
 * Having this same issue.
 * Resolved in my own project by changing the reported line from
 *     ```wp-block-code
           if ( strstr( $uri, $u ) ) {
       ```
   
 * to
 *     ```wp-block-code
           if ( strstr( $uri ?: '', $u ) ) {
       ```
   
 * Maybe not the tidiest solution, but replaces any ‘null’ instance with a string
   as desired.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[AI Engine - The Chatbot, AI Framework & MCP for WordPress] o.9.92 cause a blank setting page](https://wordpress.org/support/topic/o-9-92-cause-a-blank-setting-page/)
 *  [Tristan](https://wordpress.org/support/users/tristanmsg/)
 * (@tristanmsg)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/o-9-92-cause-a-blank-setting-page/#post-16480700)
 * I’m still getting the same blank admin page with 0.9.94, though only in debug
   mode. Console only displays
 * JQMIGRATE: Migrate is installed, version 3.3.2
 * The following is displayed on the front-end where the chatbot is used:
 * **Warning**: Undefined array key “icon” in […]**/wp-content/plugins/ai-engine/
   classes/modules/chatbot.php** on line **229**
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Ajax Load More for Advanced Custom Fields] Debug warning messages for functions.php](https://wordpress.org/support/topic/debug-warning-messages-for-functions-php/)
 *  Thread Starter [Tristan](https://wordpress.org/support/users/tristanmsg/)
 * (@tristanmsg)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/debug-warning-messages-for-functions-php/#post-16345682)
 * Hi [@dcooney](https://wordpress.org/support/users/dcooney/),
 * I’ve updated to the latest version and it looks like the issue is indeed resolved.
 * Many thanks,
 *   Forum: [Reviews](https://wordpress.org/support/forum/reviews/)
    In reply to:
   [[Phoenix Media Rename] Almost perfect, but serialization is buggy](https://wordpress.org/support/topic/almost-perfect-but-serialization-is-buggy/)
 *  Thread Starter [Tristan](https://wordpress.org/support/users/tristanmsg/)
 * (@tristanmsg)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/almost-perfect-but-serialization-is-buggy/#post-16239807)
 * Hi [@crossi72](https://wordpress.org/support/users/crossi72/),
 * I’ve emailed the plugin list over to you.
    -  This reply was modified 3 years, 7 months ago by [Tristan](https://wordpress.org/support/users/tristanmsg/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Code Snippets] “The plugin does not have a valid header.”](https://wordpress.org/support/topic/the-plugin-does-not-have-a-valid-header-231/)
 *  [Tristan](https://wordpress.org/support/users/tristanmsg/)
 * (@tristanmsg)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/the-plugin-does-not-have-a-valid-header-231/#post-16085848)
 * Update: Just tried activating from the Installed Plugins page and that worked
   for me.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Code Snippets] “The plugin does not have a valid header.”](https://wordpress.org/support/topic/the-plugin-does-not-have-a-valid-header-231/)
 *  [Tristan](https://wordpress.org/support/users/tristanmsg/)
 * (@tristanmsg)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/the-plugin-does-not-have-a-valid-header-231/#post-16085838)
 * I’ve just had the same error message.
 * The plugin installed successfully but failed to activate.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Code Snippets] Hooks not activating in certain cases](https://wordpress.org/support/topic/hooks-not-activating-in-certain-cases/)
 *  Thread Starter [Tristan](https://wordpress.org/support/users/tristanmsg/)
 * (@tristanmsg)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/hooks-not-activating-in-certain-cases/#post-15881520)
 * Okay, so it _was_ an AJAX problem.
 * Basically, the AJAX requests were being treated as if on an admin page:
 * [https://facetwp.com/is_admin-and-ajax-in-wordpress/](https://facetwp.com/is_admin-and-ajax-in-wordpress/)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Code Snippets] Hooks not activating in certain cases](https://wordpress.org/support/topic/hooks-not-activating-in-certain-cases/)
 *  Thread Starter [Tristan](https://wordpress.org/support/users/tristanmsg/)
 * (@tristanmsg)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/hooks-not-activating-in-certain-cases/#post-15881456)
 * I figured it out.
 * I set the snippet to only run on the site front end, and this caused the hooks
   to stop working. The same thing happens in ‘functions.php’ when using `is_admin()`.
 * Still not sure why it’s happening, but it’s not a plugin issue so I’ll mark this
   as resolved.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Code Snippets] Hooks not activating in certain cases](https://wordpress.org/support/topic/hooks-not-activating-in-certain-cases/)
 *  Thread Starter [Tristan](https://wordpress.org/support/users/tristanmsg/)
 * (@tristanmsg)
 * [3 years, 12 months ago](https://wordpress.org/support/topic/hooks-not-activating-in-certain-cases/#post-15850546)
 * I’ve simplified the functions way down to the following.
 * It’s now at least doing something, so that’s a start. I’ll have to look into 
   this further another day.
 * Thanks for your help!
 *     ```
       /* Hide products in excluded categories in post queries */
       add_action( 'pre_get_posts', function ( $query ) {
   
       	$parent_term_id = 106;
   
       	$query->set( 'cat', $parent_term_id );
   
       } );
   
       /* Hide products in excluded categories in AJAX Load More queries */
       add_filter( 'alm_query_args_products_list', function ( $args, $id ) {
   
       	$parent_term_id = 106;
   
       	$args['cat'] = $parent_term_id;
   
       	return $args;
   
       }, 10, 2 );
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Code Snippets] Hooks not activating in certain cases](https://wordpress.org/support/topic/hooks-not-activating-in-certain-cases/)
 *  Thread Starter [Tristan](https://wordpress.org/support/users/tristanmsg/)
 * (@tristanmsg)
 * [3 years, 12 months ago](https://wordpress.org/support/topic/hooks-not-activating-in-certain-cases/#post-15849927)
 * Here are the two hook functions, both serving the same purpose, which is to hide
   all `product`-type posts in certain categories.
 *     ```
       /* Hide products in excluded categories in post queries */
       function hide_excluded_products( $query ) {
   
       	$parent_term_id = 106;
   
       	if ( !$query->get('post_type') == 'product' || ( $query->get('tax_query') && $query->get('tax_query')[0]['terms'] == $parent_term_id ) )
       		return;
   
       	$excluded_post_ids = new WP_Query( array(
       		'post_type' => 'product',
       		'fields' => 'ids',
       		'tax_query' => array(
       			array(
       				'taxonomy' => 'product_category',
       				'field'    => 'term_id',
       				'terms'    => $parent_term_id,
       				'operator' => 'IN',
       			),
       		),
       	) );
   
       	$query->set( 'post__not_in', array_merge( $query->get('post__not_in') ?: array(), $excluded_post_ids->posts ) );
       }
       add_action( 'pre_get_posts', 'hide_excluded_products' );
   
       /* Hide products in excluded categories in AJAX Load More queries */
       function alm_hide_excluded_products( $args, $id ) {
   
       	$parent_term_id = 106;
   
       	if ( !$args['tax_query'] || $args['tax_query'][0]['terms'] != $parent_term_id ) {
   
       		$excluded_post_ids = new WP_Query( array(
       			'post_type' => 'product',
       			'fields' => 'ids',
       			'tax_query' => array(
       				array(
       					'taxonomy' => 'product_category',
       					'field'    => 'term_id',
       					'terms'    => $parent_term_id,
       					'operator' => 'IN',
       				),
       			),
       		) );
   
       		$args['post__not_in'] = array_merge($args['post__not_in'] ?: array(), $excluded_post_ids->posts);
       	}
   
       	return $args;
       }
       add_filter( 'alm_query_args_products_list', 'alm_hide_excluded_products', 10, 2);
       ```
   
 * Honestly, the content of the functions is probably irrelevant as I’m pretty sure
   the functions aren’t being called at all.
 * I can also confirm that the first hook _does_ work when using `get_posts()` without
   AJAX.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Ninja Forms - The Contact Form Builder That Grows With You] Clicking Edit icon for fields too quickly selects Delete by mistake](https://wordpress.org/support/topic/clicking-edit-icon-for-fields-too-quickly-selects-delete-by-mistake/)
 *  Thread Starter [Tristan](https://wordpress.org/support/users/tristanmsg/)
 * (@tristanmsg)
 * [4 years ago](https://wordpress.org/support/topic/clicking-edit-icon-for-fields-too-quickly-selects-delete-by-mistake/#post-15824031)
 * Cool, thanks!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Advanced Custom Fields: Extended] Individual subfields not working on forms](https://wordpress.org/support/topic/individual-subfields-not-working-on-forms/)
 *  Thread Starter [Tristan](https://wordpress.org/support/users/tristanmsg/)
 * (@tristanmsg)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/individual-subfields-not-working-on-forms/#post-15539451)
 * I was not aware of the Column field – that helps a lot!
 * Thanks!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[String locator] Editor removes backslashes when saving](https://wordpress.org/support/topic/editor-removes-backslashes-when-saving/)
 *  Thread Starter [Tristan](https://wordpress.org/support/users/tristanmsg/)
 * (@tristanmsg)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/editor-removes-backslashes-when-saving/#post-15411129)
 * Thanks for the update! Will let you know if anything else comes up.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Site Reviews] Get all reviews but omit trashed reviews](https://wordpress.org/support/topic/get-all-reviews-but-omit-trashed-reviews/)
 *  Thread Starter [Tristan](https://wordpress.org/support/users/tristanmsg/)
 * (@tristanmsg)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/get-all-reviews-but-omit-trashed-reviews/#post-15296971)
 * Works great now, thanks!

Viewing 15 replies - 1 through 15 (of 19 total)

1 [2](https://wordpress.org/support/users/tristanmsg/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/tristanmsg/replies/page/2/?output_format=md)