• Resolved Nikki Blight

    (@kionae)


    Attempted to update to 2.0.4, and am now getting the error “2023-9-18 08:33:41 – ERROR: Rule content_is_page_with_category has no callback.” in the log, and my rules no longer work. Categories are enabled on Pages through my theme’s functions.php file.

    Category is pretty much the basis for determining who sees what content on my site, so without this functionality, I’m dead in the water. Had to downgrade to previously installed version (1.1.10).

Viewing 3 replies - 16 through 18 (of 18 total)
  • Plugin Author Daniel Iser

    (@danieliser)

    @joroabv – Not a problem, rather enjoy it ??

    This same error caused an issue with the The Event Calendar when trying to restrict it’s archive and post types:

    2023-9-27 13:58:54 – ERROR: Rule content_is_tribe_events_archive has no callback.

    2023-9-27 13:58:54 – ERROR: Rule content_is_tribe_events has no callback.

    Dispite being on 2.0.9, adding this to the child theme’s functions.php file did not solve the issue:

    add_filter( 'content_control/query_filter_init_hook', function () {
        return 'init'; // Try setup_theme, after_theme_setup, init or wp_loaded
    } );

    However, this did:

    remove_filter( 'the_posts', [ \ContentControl\plugin('Frontend\Restrictions\QueryPosts'), 'restrict_query_posts' ], 10, 2 );
    
    add_action( 'init', function () {
    	add_filter( 'the_posts', [ \ContentControl\plugin('Frontend\Restrictions\QueryPosts'), 'restrict_query_posts' ], 10, 2 );
    } );
    Plugin Author Daniel Iser

    (@danieliser)

    @chrisoaten – Good catch, I think I know what is going on with it not working in theme files, I think its running too early for your themes functions.php to hook in.

    I think i’ll move our calling of the filter to init or after_setup_theme which is described as firing immediately after loading of functions.php.

    Thanks for pointing this out, will be patched in v2.0.10.

    Also by moving the call to init we might just avoid needing to add filters or hacks in the first place.

    • This reply was modified 1 year, 1 month ago by Daniel Iser.
Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘2023-9-18 08:33:41 – ERROR: Rule `content_is_page_with_category` has no callback’ is closed to new replies.