Title: Regex for Path Based Rules
Last modified: April 25, 2020

---

# Regex for Path Based Rules

 *  Resolved [fouedex](https://wordpress.org/support/users/fouedex/)
 * (@fouedex)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/regex-for-path-based-rules/)
 * 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 6 years, 1 month ago by [fouedex](https://wordpress.org/support/users/fouedex/).

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

1 [2](https://wordpress.org/support/topic/regex-for-path-based-rules/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/regex-for-path-based-rules/page/2/?output_format=md)

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/regex-for-path-based-rules/#post-12728806)
 * 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](https://wordpress.org/support/users/fouedex/)
 * (@fouedex)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/regex-for-path-based-rules/#post-12729461)
 * 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](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/regex-for-path-based-rules/#post-12729505)
 * hmm, the CPT’s should show there. what version of the plugin are you using?
 *  Thread Starter [fouedex](https://wordpress.org/support/users/fouedex/)
 * (@fouedex)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/regex-for-path-based-rules/#post-12729510)
 * Latest : 3.3.10
 *  Thread Starter [fouedex](https://wordpress.org/support/users/fouedex/)
 * (@fouedex)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/regex-for-path-based-rules/#post-12729560)
 * 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](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/regex-for-path-based-rules/#post-12729616)
 * > 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](https://wordpress.org/support/users/fouedex/)
 * (@fouedex)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/regex-for-path-based-rules/#post-12729637)
 * AO : 2.6.2
    AO CCSS power-up : 1.18.0 Both latest I believe.
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/regex-for-path-based-rules/#post-12729674)
 * Hmm … maybe [download & install AO 2.7 beta](https://github.com/futtta/autoptimize/archive/beta.zip)(
   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](https://wordpress.org/support/users/fouedex/)
 * (@fouedex)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/regex-for-path-based-rules/#post-12729895)
 * Still no luck with beta : none Toolset created types listed.
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/regex-for-path-based-rules/#post-12729991)
 * Hmm … I’ll install Toolset and test later today/ tomorrow.
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/regex-for-path-based-rules/#post-12730011)
 * 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/](https://wordpress.org/plugins/custom-post-types/)).
   Relevant code is at [https://github.com/futtta/autoptimize/blob/beta/classes/autoptimizeCriticalCSSCore.php#L192-L203](https://github.com/futtta/autoptimize/blob/beta/classes/autoptimizeCriticalCSSCore.php#L192-L203)
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/regex-for-path-based-rules/#post-12730060)
 * just tested with [https://wordpress.org/plugins/custom-post-type-ui/](https://wordpress.org/plugins/custom-post-type-ui/),
   CPT’s created with that appear as well ..
 *  Thread Starter [fouedex](https://wordpress.org/support/users/fouedex/)
 * (@fouedex)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/regex-for-path-based-rules/#post-12730399)
 * 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 6 years, 1 month ago by [fouedex](https://wordpress.org/support/users/fouedex/).
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/regex-for-path-based-rules/#post-12730711)
 * 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](https://github.com/futtta/autoptimize/commit/9aa4b369da1294ce8f8a9a7e0d26b80a61b8f70f).
   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](https://wordpress.org/support/users/fouedex/)
 * (@fouedex)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/regex-for-path-based-rules/#post-12730783)
 * Thanks !
 * Done, but still no luck, no Toolset post types in drop down.
 * F.
    -  This reply was modified 6 years, 1 month ago by [fouedex](https://wordpress.org/support/users/fouedex/).

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

1 [2](https://wordpress.org/support/topic/regex-for-path-based-rules/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/regex-for-path-based-rules/page/2/?output_format=md)

The topic ‘Regex for Path Based Rules’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/autoptimize-criticalcss.svg)
 * [Autoptimize criticalcss.com power-up](https://wordpress.org/plugins/autoptimize-criticalcss/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize-criticalcss/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize-criticalcss/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize-criticalcss/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize-criticalcss/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize-criticalcss/reviews/)

 * 17 replies
 * 2 participants
 * Last reply from: [fouedex](https://wordpress.org/support/users/fouedex/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/regex-for-path-based-rules/page/2/#post-12731005)
 * Status: resolved