Support » Plugin: Autoptimize criticalcss.com power-up » Regex for Path Based Rules

  • Resolved fouedex

    (@fouedex)


    Hi there,

    If I want a dedicated CCSS for a page, I can use “Path Based Rules”.

    I wish I could this feature with a king of regex : create CCSS for pages which match /my_cpt/*

    Although the creation label states “Enter part of the url …”, it does seem to work that way.

    Any idea ?

    • This topic was modified 2 years, 2 months ago by fouedex.
Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    if you use my_cpt/ as path in path-based-rule then that will apply to my_cpt/page_a and my_cpt/page_b. Alternatively you should be able to select your CPT in the list of conditional tags.

    hope this helps,
    frank

    Thread Starter fouedex

    (@fouedex)

    Hi & thanks.

    My CPT are all generated by Toolset, but not available in the list of conditional tags, even though declared public. Any idea ?

    As a workaround, I use a path based rule, since CPT permalink embed the CPT slug.

    F.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    hmm, the CPT’s should show there. what version of the plugin are you using?

    Thread Starter fouedex

    (@fouedex)

    Latest : 3.3.10

    Thread Starter fouedex

    (@fouedex)

    As a complement, I have a CPT say “agency” which URL is //…/agency/…
    As I can’t see them in the list, I created a Path based Rule (Path = /agency/).
    Pages I see in the job queue are still associated with target “is_single” and I see “To be fetched from criticalcss.com in the next queue run…” for a long time (ao_ccss_queue runs normally every 10 min).

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Latest : 3.3.10

    no, AO (CCSS) version I mean 🙂

    I created a Path based Rule (Path = /agency/).
    Pages I see in the job queue are still associated with target “is_single” and I see “To be fetched from criticalcss.com in the next queue run…” for a long time (ao_ccss_queue runs normally every 10 min).

    Try creating a manual rule instead maybe (and use agency/ instead of /agency/)?

    Thread Starter fouedex

    (@fouedex)

    AO : 2.6.2
    AO CCSS power-up : 1.18.0
    Both latest I believe.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Hmm … maybe download & install AO 2.7 beta (which has built-in critical css support), deactivate AO 2.6, activate 2.7 (beta 4) and then deactivate the power-up to allow AO proper to take over CCSS duties?

    I tested AO 27 with the “Custom post types” plugin and at least those are listed in the dropdown.

    AO27 will be release next week (on May 1st) 🙂

    Thread Starter fouedex

    (@fouedex)

    Still no luck with beta : none Toolset created types listed.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Hmm … I’ll install Toolset and test later today/ tomorrow.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    arghh, toolset is not on wordpress.org, only premium version. no can test mate, sorry … :-/ given it’s premium you’re entitled to support, maybe ask them why AOCCSS can’t see their CPT’s (but can see ones created by e.g. https://wordpress.org/plugins/custom-post-types/). Relevant code is at https://github.com/futtta/autoptimize/blob/beta/classes/autoptimizeCriticalCSSCore.php#L192-L203

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    just tested with https://wordpress.org/plugins/custom-post-type-ui/, CPT’s created with that appear as well ..

    Thread Starter fouedex

    (@fouedex)

    Super weird 😉

    $cpts = get_post_types(
                array(
                    'public'   => true,
                    '_builtin' => false,
                ),
                'names',
                'and'
            );

    actually returns the custom types, but still, they are not available in the drop down…

    • This reply was modified 2 years, 2 months ago by fouedex.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Darn, the types are extended on init action but that’s probably too early for toolset :-/

    Don’t want to change the default action hook for “extend types” at this point (a couple of days before release), but I added a filter in 2.7 which allows you to change the action hook yourself. So download the new beta zipfile here, install it instead of the current 2.7 and once done add a code snippet like e.g. this one to change the hook from the default init to wp_loaded;

    
    add_filter('autoptimize_filter_ccss_extend_types_hook', function (){return 'wp_loaded';});

    frank

    Thread Starter fouedex

    (@fouedex)

    Thanks !

    Done, but still no luck, no Toolset post types in drop down.

    F.

    • This reply was modified 2 years, 2 months ago by fouedex.
Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Regex for Path Based Rules’ is closed to new replies.