Question

It doesn't look like the Twenty Seventeen theme supports Infinite Scroll, and adding support doesn't work either if I add the following to functions.php:

add_theme_support( 'infinite-scroll', array(
    'container' => 'content',
    'footer' => 'page',
) );

That just results in a "Load more" button but clicking it results in the button disappearing and no further posts being loaded.

Is it possible to add support for this in the Twenty Seventeen theme?

Était-ce utile?

La solution

Well, I really should've done this to begin with, but I took a look at my NGINX logs while the infinite scroll would hang, and it turns out the NAXSI web application firewall module I'm using in NGINX is blocking infinite scroll due to anti-XSS/ant-SQL injection policies. Specifically it's because of square brackets and usage of the word "update".

Hopefully this will help anyone else out on Google with a similar issue, but here is what I added to the WordPress NAXSI whitelist to allow infinite scroll:

BasicRule wl:1310,1311 "mz:$BODY_VAR:scripts[]|NAME";
BasicRule wl:1310,1311 "mz:$BODY_VAR:styles[]|NAME";
BasicRule wl:1310,1311 "mz:$BODY_VAR_X:^query_args\[.*\]|NAME";
BasicRule wl:1000 "mz:$BODY_VAR:query_args[update_post_term_cache]|NAME";
BasicRule wl:1000 "mz:$BODY_VAR:query_args[update_post_meta_cache]|NAME";
Licencié sous: CC-BY-SA avec attribution
Non affilié à wordpress.stackexchange
scroll top