Custom Post Type Permalinks - Version 3.4.0-rc.1

Version Description

Download this release

Release Info

Developer Toro_Unit
Plugin Icon 128x128 Custom Post Type Permalinks
Version 3.4.0-rc.1
Comparing to
See all releases

Code changes from version 3.3.5 to 3.4.0-rc.1

.distignore ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A set of files you probably don't want in your WordPress.org distribution
2
+ .svnignore
3
+ .editorconfig
4
+ .git
5
+ .gitignore
6
+ .gitlab-ci.yml
7
+ .travis.yml
8
+ .vscode
9
+ .DS_Store
10
+ Thumbs.db
11
+ behat.yml
12
+ bin
13
+ circle.yml
14
+ composer.json
15
+ composer.lock
16
+ Gruntfile.js
17
+ package.json
18
+ package-lock.json
19
+ phpunit.xml
20
+ phpunit.xml.dist
21
+ multisite.xml
22
+ multisite.xml.dist
23
+ phpcs.ruleset.xml
24
+ codesniffer.ruleset.xml
25
+ README.md
26
+ wp-cli.local.yml
27
+ tests
28
+ vendor
29
+ node_modules
30
+ *.sql
31
+ *.tar.gz
32
+ *.zip
33
+ .release-it.json
34
+ .env
35
+ .wp-env.json
.phpcs.xml.dist ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <ruleset name="WordPress Coding Standards based custom ruleset for your plugin">
3
+ <description>Generally-applicable sniffs for WordPress plugins.</description>
4
+
5
+ <!-- What to scan -->
6
+ <file>.</file>
7
+ <exclude-pattern>/vendor/</exclude-pattern>
8
+ <exclude-pattern>/node_modules/</exclude-pattern>
9
+ <exclude-pattern>/wordpress/</exclude-pattern>
10
+ <exclude-pattern>/tests/</exclude-pattern>
11
+ <!-- How to scan -->
12
+ <!-- Usage instructions: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage -->
13
+ <!-- Annotated ruleset: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
14
+ <arg value="sp"/> <!-- Show sniff and progress -->
15
+ <arg name="basepath" value="./"/><!-- Strip the file paths down to the relevant bit -->
16
+ <arg name="colors"/>
17
+ <arg name="extensions" value="php"/>
18
+ <arg name="parallel" value="8"/><!-- Enables parallel processing when available for faster results. -->
19
+
20
+ <!-- Rules: Check PHP version compatibility -->
21
+ <!-- https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
22
+ <config name="testVersion" value="5.3-"/>
23
+ <!-- https://github.com/PHPCompatibility/PHPCompatibilityWP -->
24
+ <rule ref="PHPCompatibilityWP"/>
25
+ <config name="minimum_supported_wp_version" value="4.7"/>
26
+ <rule ref="WordPress-Core">
27
+ <exclude name="WordPress.Files.FileName" />
28
+ <exclude name="WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase" />
29
+ <exclude name="WordPress.NamingConventions.ValidHookName" />
30
+ </rule>
31
+ <rule ref="WordPress-Docs"/>
32
+ <rule ref="WordPress.NamingConventions.PrefixAllGlobals">
33
+ <properties>
34
+ <!-- Value: replace the function, class, and variable prefixes used. Separate multiple prefixes with a comma. -->
35
+ <property name="prefixes" type="array" value="CPTP"/>
36
+ </properties>
37
+ </rule>
38
+ <rule ref="WordPress.WP.I18n">
39
+ <properties>
40
+ <!-- Value: replace the text domain used. -->
41
+ <property name="text_domain" type="array" value="custom-post-type-permalinks"/>
42
+ </properties>
43
+ </rule>
44
+ <rule ref="WordPress.WhiteSpace.ControlStructureSpacing">
45
+ <properties>
46
+ <property name="blank_line_check" value="true"/>
47
+ </properties>
48
+ </rule>
49
+ </ruleset>
.rsyncignore DELETED
@@ -1,36 +0,0 @@
1
- - .svnignore
2
- - .idea
3
- - .rsyncignore
4
- - .editorconfig
5
- - .git
6
- - .gitignore
7
- - .gitlab-ci.yml
8
- - .travis.yml
9
- - .vscode
10
- - .DS_Store
11
- - Thumbs.db
12
- - behat.yml
13
- - bin
14
- - circle.yml
15
- - composer.json
16
- - composer.lock
17
- - Gruntfile.js
18
- - package.json
19
- - package-lock.json
20
- - phpunit.xml
21
- - phpunit.xml.dist
22
- - multisite.xml
23
- - multisite.xml.dist
24
- - phpcs.ruleset.xml
25
- - codesniffer.ruleset.xml
26
- - README.md
27
- - wp-cli.local.yml
28
- - tests
29
- - vendor
30
- - node_modules
31
- - *.sql
32
- - *.tar.gz
33
- - *.zip
34
- - .release-it.json
35
- - .env
36
- - docker-compose.yml
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
CPTP.php CHANGED
@@ -49,6 +49,7 @@ class CPTP {
49
  $this->set_module( 'flush_rules', new CPTP_Module_FlushRules() );
50
 
51
  do_action( 'CPTP_load_modules', $this );
 
52
  }
53
 
54
  /**
@@ -62,6 +63,7 @@ class CPTP {
62
  }
63
 
64
  do_action( 'CPTP_registered_modules', $this );
 
65
  }
66
 
67
  /**
@@ -74,6 +76,7 @@ class CPTP {
74
  */
75
  public function set_module( $name, CPTP_Module $module ) {
76
  $module = apply_filters( "CPTP_set_{$name}_module", $module );
 
77
  if ( $module instanceof CPTP_Module ) {
78
  $this->modules[ $name ] = $module;
79
  }
@@ -89,6 +92,7 @@ class CPTP {
89
  public function init() {
90
  $this->init_modules();
91
  do_action( 'CPTP_init' );
 
92
  }
93
 
94
  /**
49
  $this->set_module( 'flush_rules', new CPTP_Module_FlushRules() );
50
 
51
  do_action( 'CPTP_load_modules', $this );
52
+ do_action( 'cptp_load_modules', $this );
53
  }
54
 
55
  /**
63
  }
64
 
65
  do_action( 'CPTP_registered_modules', $this );
66
+ do_action( 'cptp_registered_modules', $this );
67
  }
68
 
69
  /**
76
  */
77
  public function set_module( $name, CPTP_Module $module ) {
78
  $module = apply_filters( "CPTP_set_{$name}_module", $module );
79
+ $module = apply_filters( "cptp_set_{$name}_module", $module );
80
  if ( $module instanceof CPTP_Module ) {
81
  $this->modules[ $name ] = $module;
82
  }
92
  public function init() {
93
  $this->init_modules();
94
  do_action( 'CPTP_init' );
95
+ do_action( 'cptp_init' );
96
  }
97
 
98
  /**
CPTP/Module.php CHANGED
@@ -21,7 +21,7 @@ abstract class CPTP_Module {
21
  * Register hook on CPTP_init.
22
  */
23
  public function register() {
24
- add_action( 'CPTP_init', array( $this, 'add_hook' ) );
25
  }
26
 
27
  /**
21
  * Register hook on CPTP_init.
22
  */
23
  public function register() {
24
+ add_action( 'cptp_init', array( $this, 'add_hook' ) );
25
  }
26
 
27
  /**
CPTP/Module/Admin.php CHANGED
@@ -76,7 +76,7 @@ class CPTP_Module_Admin extends CPTP_Module {
76
  )
77
  );
78
 
79
- register_setting( 'permalink', 'no_taxonomy_structure' );
80
  }
81
 
82
  /**
@@ -105,8 +105,17 @@ class CPTP_Module_Admin extends CPTP_Module {
105
  );
106
  ?>
107
 
108
- <p><?php echo wp_kses( __( 'The tags you can use are WordPress Structure Tags and <code>%"custom_taxonomy_slug"%</code> (e.g. <code>%actors%</code> or <code>%movie_actors%</code>).', 'custom-post-type-permalinks' ), $allowed_html_code_tag ); ?>
109
- <?php echo wp_kses( __( '<code>%"custom_taxonomy_slug"%</code> is replaced by the term of taxonomy.', 'custom-post-type-permalinks' ), $allowed_html_code_tag ); ?></p>
 
 
 
 
 
 
 
 
 
110
 
111
  <p><?php esc_html_e( "Presence of the trailing '/' is unified into a standard permalink structure setting.", 'custom-post-type-permalinks' ); ?>
112
  <p><?php echo wp_kses( __( 'If <code>has_archive</code> is true, add permalinks for custom post type archive.', 'custom-post-type-permalinks' ), $allowed_html_code_tag ); ?></p>
@@ -119,8 +128,9 @@ class CPTP_Module_Admin extends CPTP_Module {
119
  *
120
  * @param array $option {
121
  * Callback option.
122
- * @type string 'post_type' post type name.
123
- * @type string 'label_for' post type label.
 
124
  * }
125
  */
126
  public function setting_structure_callback_function( $option ) {
@@ -162,6 +172,7 @@ class CPTP_Module_Admin extends CPTP_Module {
162
  public function setting_no_tax_structure_callback_function() {
163
  $no_taxonomy_structure = CPTP_Util::get_no_taxonomy_structure();
164
  echo '<input name="no_taxonomy_structure" id="no_taxonomy_structure" type="checkbox" value="1" class="code" ' . checked( false, $no_taxonomy_structure, false ) . ' /> ';
 
165
  $txt = __( "If you check this, the custom taxonomy's permalinks will be <code>%s/post_type/taxonomy/term</code>.", 'custom-post-type-permalinks' );
166
  echo sprintf( wp_kses( $txt, array( 'code' => array() ) ), esc_html( home_url() ) );
167
  }
@@ -175,7 +186,6 @@ class CPTP_Module_Admin extends CPTP_Module {
175
  esc_html_e( 'There are cases when the template to be loaded is changed.', 'custom-post-type-permalinks' );
176
  }
177
 
178
-
179
  /**
180
  * Enqueue css and js
181
  *
@@ -186,7 +196,7 @@ class CPTP_Module_Admin extends CPTP_Module {
186
  if ( ! is_network_admin() ) {
187
  $dismissed = explode( ',', get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
188
  if ( false === array_search( $pointer_name, $dismissed, true ) ) {
189
- $content = '';
190
  $content .= '<h3>' . __( 'Custom Post Type Permalinks', 'custom-post-type-permalinks' ) . '</h3>';
191
  $content .= '<p>' . __( 'You can setting permalink for post type in <a href="options-permalink.php">Permalinks</a>.', 'custom-post-type-permalinks' ) . '</p>';
192
 
76
  )
77
  );
78
 
79
+ register_setting( 'permalink', 'add_post_type_for_tax' );
80
  }
81
 
82
  /**
105
  );
106
  ?>
107
 
108
+ <?php
109
+ $taxonomies = CPTP_Util::get_taxonomies();
110
+ ?>
111
+ <p><?php esc_html_e( 'The tags you can use are WordPress structure tags and taxonomy tags.', 'custom-post-type-permalinks' ); ?></p>
112
+ <p><?php esc_html_e( 'Available taxonomy tags:', 'custom-post-type-permalinks' ); ?>
113
+ <?php
114
+ foreach ( $taxonomies as $taxonomy ) {
115
+ echo sprintf( '<code>%%%s%%</code>', esc_html( $taxonomy ) );
116
+ }
117
+ ?>
118
+ </p>
119
 
120
  <p><?php esc_html_e( "Presence of the trailing '/' is unified into a standard permalink structure setting.", 'custom-post-type-permalinks' ); ?>
121
  <p><?php echo wp_kses( __( 'If <code>has_archive</code> is true, add permalinks for custom post type archive.', 'custom-post-type-permalinks' ), $allowed_html_code_tag ); ?></p>
128
  *
129
  * @param array $option {
130
  * Callback option.
131
+ *
132
+ * @type string 'post_type' post type name.
133
+ * @type string 'label_for' post type label.
134
  * }
135
  */
136
  public function setting_structure_callback_function( $option ) {
172
  public function setting_no_tax_structure_callback_function() {
173
  $no_taxonomy_structure = CPTP_Util::get_no_taxonomy_structure();
174
  echo '<input name="no_taxonomy_structure" id="no_taxonomy_structure" type="checkbox" value="1" class="code" ' . checked( false, $no_taxonomy_structure, false ) . ' /> ';
175
+ /* translators: %s site url */
176
  $txt = __( "If you check this, the custom taxonomy's permalinks will be <code>%s/post_type/taxonomy/term</code>.", 'custom-post-type-permalinks' );
177
  echo sprintf( wp_kses( $txt, array( 'code' => array() ) ), esc_html( home_url() ) );
178
  }
186
  esc_html_e( 'There are cases when the template to be loaded is changed.', 'custom-post-type-permalinks' );
187
  }
188
 
 
189
  /**
190
  * Enqueue css and js
191
  *
196
  if ( ! is_network_admin() ) {
197
  $dismissed = explode( ',', get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
198
  if ( false === array_search( $pointer_name, $dismissed, true ) ) {
199
+ $content = '';
200
  $content .= '<h3>' . __( 'Custom Post Type Permalinks', 'custom-post-type-permalinks' ) . '</h3>';
201
  $content .= '<p>' . __( 'You can setting permalink for post type in <a href="options-permalink.php">Permalinks</a>.', 'custom-post-type-permalinks' ) . '</p>';
202
 
CPTP/Module/GetArchives.php CHANGED
@@ -133,7 +133,7 @@ class CPTP_Module_GetArchives extends CPTP_Module {
133
 
134
  // remove front.
135
  $front = substr( $wp_rewrite->front, 1 );
136
- $html = str_replace( $front, '', $html );
137
 
138
  $blog_url = preg_replace( '/https?:\/\//', '', $blog_url );
139
  $ret_link = str_replace( $blog_url, $blog_url . '/%link_dir%', $html );
@@ -146,7 +146,7 @@ class CPTP_Module_GetArchives extends CPTP_Module {
146
  }
147
  } else {
148
  $c['name'] = ( 'category' === $c['name'] && get_option( 'category_base' ) ) ? get_option( 'category_base' ) : $c['name'];
149
- $link_dir = $post_type->rewrite['slug'] . '/' . $c['name'] . '/' . $c['termslug'];
150
  }
151
 
152
  if ( ! strstr( $html, '/date/' ) ) {
133
 
134
  // remove front.
135
  $front = substr( $wp_rewrite->front, 1 );
136
+ $html = str_replace( $front, '', $html );
137
 
138
  $blog_url = preg_replace( '/https?:\/\//', '', $blog_url );
139
  $ret_link = str_replace( $blog_url, $blog_url . '/%link_dir%', $html );
146
  }
147
  } else {
148
  $c['name'] = ( 'category' === $c['name'] && get_option( 'category_base' ) ) ? get_option( 'category_base' ) : $c['name'];
149
+ $link_dir = $post_type->rewrite['slug'] . '/' . $c['name'] . '/' . $c['termslug'];
150
  }
151
 
152
  if ( ! strstr( $html, '/date/' ) ) {
CPTP/Module/Option.php CHANGED
@@ -72,8 +72,8 @@ class CPTP_Module_Option extends CPTP_Module {
72
  $no_taxonomy_structure = ! filter_input( INPUT_POST, 'no_taxonomy_structure' );
73
  $add_post_type_for_tax = filter_input( INPUT_POST, 'add_post_type_for_tax' );
74
 
75
- update_option( 'no_taxonomy_structure', $no_taxonomy_structure );
76
- update_option( 'add_post_type_for_tax', $add_post_type_for_tax );
77
  update_option( 'cptp_permalink_checked', CPTP_VERSION );
78
  }
79
 
72
  $no_taxonomy_structure = ! filter_input( INPUT_POST, 'no_taxonomy_structure' );
73
  $add_post_type_for_tax = filter_input( INPUT_POST, 'add_post_type_for_tax' );
74
 
75
+ update_option( 'no_taxonomy_structure', ! ! $no_taxonomy_structure );
76
+ update_option( 'add_post_type_for_tax', ! ! $add_post_type_for_tax );
77
  update_option( 'cptp_permalink_checked', CPTP_VERSION );
78
  }
79
 
CPTP/Module/Permalink.php CHANGED
@@ -37,6 +37,13 @@ class CPTP_Module_Permalink extends CPTP_Module {
37
  apply_filters( 'cptp_attachment_link_priority', 20 ),
38
  2
39
  );
 
 
 
 
 
 
 
40
  }
41
 
42
 
@@ -90,7 +97,7 @@ class CPTP_Module_Permalink extends CPTP_Module {
90
  $permalink = $wp_rewrite->get_extra_permastruct( $post_type );
91
 
92
  $permalink = str_replace( '%post_id%', $post->ID, $permalink );
93
- $permalink = str_replace( '%' . $post_type . '_slug%', $pt_object->rewrite['slug'], $permalink );
94
 
95
  // has parent.
96
  $parentsDirs = '';
@@ -140,9 +147,21 @@ class CPTP_Module_Permalink extends CPTP_Module {
140
  if ( false !== strpos( $permalink, '%category%' ) ) {
141
  $categories = get_the_category( $post->ID );
142
  if ( $categories ) {
143
- $categories = CPTP_Util::sort_terms( $categories );
 
144
  // phpcs:ignore
145
- $category_object = apply_filters( 'post_link_category', $categories[0], $categories, $post );
 
 
 
 
 
 
 
 
 
 
 
146
  $category_object = get_term( $category_object, 'category' );
147
  $category = $category_object->slug;
148
  if ( $category_object->parent ) {
@@ -207,6 +226,7 @@ class CPTP_Module_Permalink extends CPTP_Module {
207
  $search = array();
208
  $replace = array();
209
 
 
210
  $taxonomies = CPTP_Util::get_taxonomies( true );
211
 
212
  // %taxnomomy% -> parent/child
@@ -223,7 +243,19 @@ class CPTP_Module_Permalink extends CPTP_Module {
223
  }
224
  }
225
 
226
- $term_obj = reset( $newTerms );
 
 
 
 
 
 
 
 
 
 
 
 
227
  $term_slug = $term_obj->slug;
228
 
229
  if ( isset( $term_obj->parent ) && $term_obj->parent ) {
@@ -388,4 +420,18 @@ class CPTP_Module_Permalink extends CPTP_Module {
388
 
389
  return $termlink;
390
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
391
  }
37
  apply_filters( 'cptp_attachment_link_priority', 20 ),
38
  2
39
  );
40
+
41
+ add_filter(
42
+ 'wpml_st_post_type_link_filter_original_slug',
43
+ array( $this, 'replace_post_slug_with_placeholder' ),
44
+ 10,
45
+ 3
46
+ );
47
  }
48
 
49
 
97
  $permalink = $wp_rewrite->get_extra_permastruct( $post_type );
98
 
99
  $permalink = str_replace( '%post_id%', $post->ID, $permalink );
100
+ $permalink = str_replace( CPTP_Module_Rewrite::get_slug_placeholder( $post_type ), $pt_object->rewrite['slug'], $permalink );
101
 
102
  // has parent.
103
  $parentsDirs = '';
147
  if ( false !== strpos( $permalink, '%category%' ) ) {
148
  $categories = get_the_category( $post->ID );
149
  if ( $categories ) {
150
+ $categories = CPTP_Util::sort_terms( $categories );
151
+ $category_object = reset( $categories );
152
  // phpcs:ignore
153
+ $category_object = apply_filters( 'post_link_category', $category_object, $categories, $post );
154
+
155
+ /**
156
+ * Filters the category for a post of a custom post type.
157
+ *
158
+ * @since 3.4.0
159
+ *
160
+ * @param WP_Term $category_object Selected category.
161
+ * @param WP_Term[] $categories Categories set in post.
162
+ * @param WP_Post $post Post object.
163
+ */
164
+ $category_object = apply_filters( 'cptp_post_link_category', $category_object, $categories, $post );
165
  $category_object = get_term( $category_object, 'category' );
166
  $category = $category_object->slug;
167
  if ( $category_object->parent ) {
226
  $search = array();
227
  $replace = array();
228
 
229
+ $post = get_post( $post_id );
230
  $taxonomies = CPTP_Util::get_taxonomies( true );
231
 
232
  // %taxnomomy% -> parent/child
243
  }
244
  }
245
 
246
+ $term_obj = reset( $newTerms );
247
+
248
+ /**
249
+ * Filters the term for a post of a custom post type.
250
+ *
251
+ * @since 3.4.0
252
+ *
253
+ * @param WP_Term $term_obj Selected term.
254
+ * @param WP_Term[] $terms Terms set in post.
255
+ * @param WP_Taxonomy $taxonomy Taxonomy object.
256
+ * @param WP_Post $post Post object.
257
+ */
258
+ $term_obj = apply_filters( 'cptp_post_link_term', $term_obj, $terms, $taxonomy, $post );
259
  $term_slug = $term_obj->slug;
260
 
261
  if ( isset( $term_obj->parent ) && $term_obj->parent ) {
420
 
421
  return $termlink;
422
  }
423
+
424
+ /**
425
+ * This filter is needed for WPML's compatibility. It will return
426
+ * the slug placeholder instead of the original CPT slug.
427
+ *
428
+ * @param string $original_slug The original CPT slug.
429
+ * @param string $post_link The post link.
430
+ * @param WP_Post $post The post.
431
+ *
432
+ * @return string
433
+ */
434
+ public function replace_post_slug_with_placeholder( $original_slug, $post_link, $post ) {
435
+ return CPTP_Module_Rewrite::get_slug_placeholder( $post->post_type );
436
+ }
437
  }
CPTP/Module/Rewrite.php CHANGED
@@ -59,10 +59,11 @@ class CPTP_Module_Rewrite extends CPTP_Module {
59
  $permalink = CPTP_DEFAULT_PERMALINK;
60
  }
61
 
62
- $permalink = '%' . $post_type . '_slug%' . $permalink;
63
- $permalink = str_replace( '%postname%', '%' . $post_type . '%', $permalink );
 
64
 
65
- add_rewrite_tag( '%' . $post_type . '_slug%', '(' . $args->rewrite['slug'] . ')', 'post_type=' . $post_type . '&slug=' );
66
 
67
  $taxonomies = CPTP_Util::get_taxonomies( true );
68
  foreach ( $taxonomies as $taxonomy => $objects ) :
@@ -280,4 +281,15 @@ class CPTP_Module_Rewrite extends CPTP_Module {
280
  }
281
  }
282
  }
 
 
 
 
 
 
 
 
 
 
 
283
  }
59
  $permalink = CPTP_DEFAULT_PERMALINK;
60
  }
61
 
62
+ $slug_placeholder = self::get_slug_placeholder( $post_type );
63
+ $permalink = $slug_placeholder . $permalink;
64
+ $permalink = str_replace( '%postname%', '%' . $post_type . '%', $permalink );
65
 
66
+ add_rewrite_tag( $slug_placeholder, '(' . $args->rewrite['slug'] . ')', 'post_type=' . $post_type . '&slug=' );
67
 
68
  $taxonomies = CPTP_Util::get_taxonomies( true );
69
  foreach ( $taxonomies as $taxonomy => $objects ) :
281
  }
282
  }
283
  }
284
+
285
+ /**
286
+ * Returns the slug placeholder user in the permalink structure.
287
+ *
288
+ * @param string $post_type The post type.
289
+ *
290
+ * @return string
291
+ */
292
+ public static function get_slug_placeholder( $post_type ) {
293
+ return '%' . $post_type . '_slug%';
294
+ }
295
  }
CPTP/Util.php CHANGED
@@ -58,6 +58,7 @@ class CPTP_Util {
58
  * @param bool $support support CPTP.
59
  */
60
  $support = apply_filters( "CPTP_is_rewrite_supported_by_${post_type}", $support );
 
61
 
62
  /**
63
  * Filters support CPTP for custom post type.
@@ -67,7 +68,8 @@ class CPTP_Util {
67
  * @param bool $support support CPTP.
68
  * @param string $post_type post type name.
69
  */
70
- return apply_filters( 'CPTP_is_rewrite_supported', $support, $post_type );
 
71
  }
72
 
73
  /**
@@ -121,7 +123,7 @@ class CPTP_Util {
121
 
122
  if ( $parent->parent && ( $parent->parent !== $parent->term_id ) && ! in_array( $parent->parent, $visited, true ) ) {
123
  $visited[] = $parent->parent;
124
- $chain .= CPTP_Util::get_taxonomy_parents_slug( $parent->parent, $taxonomy, $separator, $nicename, $visited );
125
  }
126
  $chain .= $name . $separator;
127
 
@@ -157,7 +159,7 @@ class CPTP_Util {
157
 
158
  if ( $parent->parent && ( $parent->parent !== $parent->term_id ) && ! in_array( $parent->parent, $visited, true ) ) {
159
  $visited[] = $parent->parent;
160
- $chain .= CPTP_Util::get_taxonomy_parents( $parent->parent, $taxonomy, $link, $separator, $nicename, $visited );
161
  }
162
  if ( $link ) {
163
  // phpcs:ignore
@@ -185,14 +187,15 @@ class CPTP_Util {
185
 
186
  if ( ! empty( $post_type->cptp ) && ! empty( $post_type->cptp['permalink_structure'] ) ) {
187
  $structure = $post_type->cptp->permalink_structure;
188
- } else if ( ! empty( $post_type->cptp_permalink_structure ) ) {
189
  $structure = $post_type->cptp_permalink_structure;
190
  } else {
191
  $structure = get_option( $post_type->name . '_structure', '%postname%' );
192
  }
193
  $structure = '/' . ltrim( $structure, '/' );
194
 
195
- return apply_filters( 'CPTP_' . $post_type->name . '_structure', $structure );
 
196
  }
197
 
198
  /**
@@ -262,7 +265,10 @@ class CPTP_Util {
262
  $tok_index ++;
263
  }
264
 
265
- return apply_filters( 'CPTP_date_front', $front, $post_type, $structure );
 
 
 
266
  }
267
 
268
  /**
58
  * @param bool $support support CPTP.
59
  */
60
  $support = apply_filters( "CPTP_is_rewrite_supported_by_${post_type}", $support );
61
+ $support = apply_filters( "cptp_is_rewrite_supported_by_${post_type}", $support );
62
 
63
  /**
64
  * Filters support CPTP for custom post type.
68
  * @param bool $support support CPTP.
69
  * @param string $post_type post type name.
70
  */
71
+ $support = apply_filters( 'CPTP_is_rewrite_supported', $support, $post_type );
72
+ return apply_filters( 'cptp_is_rewrite_supported', $support, $post_type );
73
  }
74
 
75
  /**
123
 
124
  if ( $parent->parent && ( $parent->parent !== $parent->term_id ) && ! in_array( $parent->parent, $visited, true ) ) {
125
  $visited[] = $parent->parent;
126
+ $chain .= CPTP_Util::get_taxonomy_parents_slug( $parent->parent, $taxonomy, $separator, $nicename, $visited );
127
  }
128
  $chain .= $name . $separator;
129
 
159
 
160
  if ( $parent->parent && ( $parent->parent !== $parent->term_id ) && ! in_array( $parent->parent, $visited, true ) ) {
161
  $visited[] = $parent->parent;
162
+ $chain .= CPTP_Util::get_taxonomy_parents( $parent->parent, $taxonomy, $link, $separator, $nicename, $visited );
163
  }
164
  if ( $link ) {
165
  // phpcs:ignore
187
 
188
  if ( ! empty( $post_type->cptp ) && ! empty( $post_type->cptp['permalink_structure'] ) ) {
189
  $structure = $post_type->cptp->permalink_structure;
190
+ } elseif ( ! empty( $post_type->cptp_permalink_structure ) ) {
191
  $structure = $post_type->cptp_permalink_structure;
192
  } else {
193
  $structure = get_option( $post_type->name . '_structure', '%postname%' );
194
  }
195
  $structure = '/' . ltrim( $structure, '/' );
196
 
197
+ $structure = apply_filters( 'CPTP_' . $post_type->name . '_structure', $structure );
198
+ return apply_filters( 'cptp_' . $post_type->name . '_structure', $structure );
199
  }
200
 
201
  /**
265
  $tok_index ++;
266
  }
267
 
268
+ $front = apply_filters( 'CPTP_date_front', $front, $post_type, $structure );
269
+ $front = apply_filters( 'cptp_date_front', $front, $post_type, $structure );
270
+
271
+ return $front;
272
  }
273
 
274
  /**
custom-post-type-permalinks.php CHANGED
@@ -5,13 +5,13 @@
5
  * Description: Add post archives of custom post type and customizable permalinks.
6
  * Author: Toro_Unit
7
  * Author URI: https://torounit.com/
8
- * Version: 3.3.5
9
  * Text Domain: custom-post-type-permalinks
10
  * License: GPL2 or later
11
  * Domain Path: /language/
12
  *
13
  * @package Custom_Post_Type_Permalinks
14
- * @version 3.3.5
15
  */
16
 
17
  define( 'CPTP_PLUGIN_FILE', __FILE__ );
@@ -20,15 +20,15 @@ define( 'CPTP_DEFAULT_PERMALINK', '/%postname%/' );
20
  $cptp_data = get_file_data(
21
  __FILE__,
22
  array(
23
- 'Name' => 'Plugin Name',
24
- 'PluginURI' => 'Plugin URI',
25
- 'Version' => 'Version',
26
  'Description' => 'Description',
27
- 'Author' => 'Author',
28
- 'AuthorURI' => 'Author URI',
29
- 'TextDomain' => 'Text Domain',
30
- 'DomainPath' => 'Domain Path',
31
- 'Network' => 'Network',
32
  )
33
  );
34
 
@@ -36,6 +36,8 @@ define( 'CPTP_VERSION', $cptp_data['Version'] );
36
  define( 'CPTP_DOMAIN_PATH', $cptp_data['DomainPath'] );
37
  define( 'CPTP_TEXT_DOMAIN', $cptp_data['TextDomain'] );
38
 
 
 
39
 
40
  /**
41
  * Autoloader for CPTP.
5
  * Description: Add post archives of custom post type and customizable permalinks.
6
  * Author: Toro_Unit
7
  * Author URI: https://torounit.com/
8
+ * Version: 3.4.0-rc.1
9
  * Text Domain: custom-post-type-permalinks
10
  * License: GPL2 or later
11
  * Domain Path: /language/
12
  *
13
  * @package Custom_Post_Type_Permalinks
14
+ * @version 3.4.0-rc.1
15
  */
16
 
17
  define( 'CPTP_PLUGIN_FILE', __FILE__ );
20
  $cptp_data = get_file_data(
21
  __FILE__,
22
  array(
23
+ 'Name' => 'Plugin Name',
24
+ 'PluginURI' => 'Plugin URI',
25
+ 'Version' => 'Version',
26
  'Description' => 'Description',
27
+ 'Author' => 'Author',
28
+ 'AuthorURI' => 'Author URI',
29
+ 'TextDomain' => 'Text Domain',
30
+ 'DomainPath' => 'Domain Path',
31
+ 'Network' => 'Network',
32
  )
33
  );
34
 
36
  define( 'CPTP_DOMAIN_PATH', $cptp_data['DomainPath'] );
37
  define( 'CPTP_TEXT_DOMAIN', $cptp_data['TextDomain'] );
38
 
39
+ unset( $cptp_data );
40
+
41
 
42
  /**
43
  * Autoloader for CPTP.
docker-compose.yml DELETED
@@ -1,54 +0,0 @@
1
- version: '3.1'
2
-
3
- services:
4
-
5
- wordpress:
6
- image: wordpress
7
- ports:
8
- - 50080:80
9
- environment:
10
- WORDPRESS_DB_PASSWORD: example
11
- ABSPATH: /usr/src/wordpress/
12
- volumes:
13
- - wordpress:/var/www/html
14
- - .:/var/www/html/wp-content/plugins/custom-post-type-permalinks
15
- depends_on:
16
- - mysql
17
-
18
- cli:
19
- image: wordpress:cli
20
- user: xfs
21
- volumes:
22
- - wordpress:/var/www/html
23
- - ./bin:/opt/bin
24
- - .:/var/www/html/wp-content/plugins/custom-post-type-permalinks
25
- depends_on:
26
- - mysql
27
- - wordpress
28
- command: >
29
- sh /opt/bin/wait-for.sh mysql:3306 -t 60 -- sh /opt/bin/install.sh 50080
30
-
31
- mysql:
32
- image: mysql:5.7
33
- environment:
34
- MYSQL_ROOT_PASSWORD: example
35
- MYSQL_DATABASE: wordpress_test
36
-
37
- wordpress_phpunit:
38
- image: chriszarate/wordpress-phpunit
39
- environment:
40
- PHPUNIT_DB_HOST: mysql
41
- volumes:
42
- - .:/app
43
- - testsuite:/tmp
44
- depends_on:
45
- - mysql
46
-
47
- composer:
48
- image: composer
49
- volumes:
50
- - .:/app
51
-
52
- volumes:
53
- testsuite:
54
- wordpress:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.md DELETED
@@ -1,362 +0,0 @@
1
- # Custom Post Type Permalinks
2
- Donate link: https://www.paypal.me/torounit
3
- Requires PHP: 5.3
4
-
5
- Edit the permalink of custom post type.
6
-
7
-
8
- [![Latest Stable Version](https://poser.pugx.org/torounit/custom-post-type-permalinks/v/stable)](https://packagist.org/packages/torounit/custom-post-type-permalinks)
9
- [![License](https://poser.pugx.org/torounit/custom-post-type-permalinks/license)](https://packagist.org/packages/torounit/custom-post-type-permalinks)
10
- [![Downloads](https://img.shields.io/wordpress/plugin/dt/custom-post-type-permalinks.svg)](https://wordpress.org/plugins/custom-post-type-permalinks/)
11
- [![Tested up](https://img.shields.io/wordpress/v/custom-post-type-permalinks.svg)](https://wordpress.org/plugins/custom-post-type-permalinks/)
12
- [![wp.org rating](https://img.shields.io/wordpress/plugin/r/custom-post-type-permalinks.svg)](https://wordpress.org/plugins/custom-post-type-permalinks/)
13
- [![Build Status](https://travis-ci.org/torounit/custom-post-type-permalinks.svg)](https://travis-ci.org/torounit/custom-post-type-permalinks)
14
- [![Donation](https://img.shields.io/badge/bitcoin-donate-yellow.svg)](https://blockchain.info/ja/address/3HwkojX2pd9wc5kPFdXnDXMTNbgBmPRygX)
15
- [![](https://ps.w.org/custom-post-type-permalinks/assets/banner-1544x500.png?rev=1044335)](https://wordpress.org/plugins/custom-post-type-permalinks/)
16
-
17
- ## Description
18
-
19
- Custom Post Type Permalinks allow you edit the permalink structure of custom post type.
20
-
21
- Change custom taxonomy archive's permalink to "example.org/post_type/taxonomy_name/term_slug". Can disable this fix.
22
-
23
- And support `wp_get_archives( 'post_type=foo' )` and post type date archive (ex. `example.com/post_type_slug/date/2010/01/01` ).
24
-
25
- [This Plugin published on GitHub.](https://github.com/torounit/custom-post-type-permalinks)
26
-
27
- Donation: Please send [My Wishlist](http://www.amazon.co.jp/registry/wishlist/COKSXS25MVQV) or [Paypal](https://www.paypal.me/torounit)
28
-
29
-
30
- ### Translators
31
-
32
- * Japanese(ja) - [Toro_Unit](http://www.torounit.com/)
33
- * French(fr_FR) - [Geoffrey Crofte](http://geoffrey.crofte.fr/)
34
- * Russian(ru_RU) - [Olart](http://olart.ru), [Natali_Z](https://profiles.wordpress.org/natali_z)
35
-
36
- ### Also checkout
37
-
38
- * [Simple Post Type Permalinks](https://wordpress.org/plugins/simple-post-type-permalinks/)
39
-
40
-
41
- ## Setting on Code
42
-
43
- Example:
44
-
45
- `
46
- register_post_type( 'foo',
47
- array(
48
- 'public' => true,
49
- 'has_archive' => true,
50
- 'rewrite' => array(
51
- "with_front" => true
52
- ),
53
- 'cptp_permalink_structure' => '%post_id%'
54
- )
55
- );
56
- `
57
-
58
-
59
- ## Installation
60
-
61
- * Download the custom-post-type-permalinks.zip file to your computer.
62
- * Unzip the file.
63
- * Upload the `custom-post-type-permalinks` directory to your `/wp-content/plugins/` directory.
64
- * Activate the plugin through the 'Plugins' menu in WordPress.
65
-
66
- That's it. You can access the permalinks setting by going to *Settings -> Permalinks*.
67
-
68
-
69
- ## Screenshots
70
-
71
- * screenshot-1.png
72
-
73
-
74
- ## Changelog
75
-
76
- ### 3.3.5
77
-
78
- * Tested 5.4
79
- * fix CPTP_Module_Permalink::post_type_link.
80
-
81
- ### 3.3.1
82
-
83
- * Add disable option for date / author and post type archive.
84
- * Bug fix for `parse_request`.
85
-
86
- ### 3.2.2
87
-
88
- * Fix readme.txt
89
-
90
- ### 3.2.0
91
-
92
- * Support only public post type.
93
- * Add `CPTP_is_rewrite_supported_by_${post_type}` and `CPTP_is_rewrite_supported` filter.
94
- * Remove post_type query wp_get_archives.
95
-
96
- ### 3.1.4
97
-
98
- * Test for WordPress 4.9.
99
- * PHPCS fix.
100
-
101
- ### 3.1.3
102
-
103
- * Test for WordPress 4.8.
104
- * Bug fix for attachment link.
105
-
106
- ### 3.1.1
107
-
108
- * Bug fix in `CPTP_Module_Setting::upgrader_process_complete`.
109
-
110
- ### 3.1.0
111
-
112
- * Add filter `CPTP_date_front`.
113
- * Fix sort term by `wp_list_sort` .
114
-
115
- ### 3.0.0
116
-
117
- * Admin notice on update plugin.
118
- * Large bug fix.
119
- * no_taxonomy_structure bug fix.
120
- * Add default value for options.
121
-
122
- ### 2.2.0
123
-
124
- * add `CPTP_Util::get_no_taxonomy_structure`.
125
-
126
- ### 2.1.3
127
-
128
- * Set `no_taxonomy_structure` default `true`.
129
-
130
- ### 2.1.2
131
-
132
- * `rewirte => false` post type support.
133
-
134
- ### 2.1.0
135
-
136
- * Create rewrite rule on `registered_post_type` and `registered_taxonomy` action.
137
- * Not create taxonomy rewrite rule when `rewrite` is `false`.
138
-
139
- ### 2.0.2
140
-
141
- * pointer html bug fix.
142
-
143
- ### 2.0.0
144
-
145
- * `add_rewrite_rules` on `wp_loaded` priority is changed 10 from 100. [fix issue #53](https://github.com/torounit/custom-post-type-permalinks/issues/53)
146
- * Replace `wp_get_post_terms` by `get_the_terms`. [fix issue #55](https://github.com/torounit/custom-post-type-permalinks/issues/55)
147
- * Fix bug `register_uninstall_hook` called twice on each page. [fix issue #56](https://github.com/torounit/custom-post-type-permalinks/issues/56)
148
-
149
- ### 1.5.4
150
-
151
- * Fixed removed parent post problem.
152
-
153
-
154
- ### 1.5.3
155
-
156
- * readme fix.
157
-
158
- ### 1.5.0
159
-
160
- * Tested for 4.5.
161
- * Add filter `CPTP_set_{$module_name}_module`.
162
-
163
-
164
- ### 1.4.0
165
-
166
- * Fix Translation Problem.
167
-
168
-
169
- ### 1.3.1
170
-
171
- * bugfix `wp_get_archives`.
172
-
173
- ### 1.3.0
174
-
175
- * bugfix for polylang.
176
-
177
- ### 1.2.0
178
-
179
- * Add filter `cptp_post_type_link_priority`, `cptp_term_link_priority`, `cptp_attachment_link_priority`.
180
- * Add action `CPTP_registered_modules`.
181
-
182
- ### 1.1.0
183
-
184
- * WPML Test. thanks [keita_kobayashi](https://profiles.wordpress.org/keita_kobayashi) !
185
-
186
- ### 1.0.5
187
-
188
- * admin bug fix. thanks [ixkaito](https://profiles.wordpress.org/ixkaito) !
189
- * Translation Update Thanks [Natali_Z](https://profiles.wordpress.org/natali_z) !
190
-
191
- ### 1.0.4
192
-
193
- * option bug fix.
194
-
195
- ### 1.0.3
196
-
197
- * add category rule, if only attached category to post type.
198
-
199
- ### 1.0.2
200
-
201
- * category slug bug fix.
202
-
203
- ### 1.0.0
204
-
205
- * Set Permalink enable `register_post_type`.
206
- * Enable add post type query to taxonomy archives.
207
- * Use Class Autoloader.
208
- * Create Rewrite Rule on `wp_loaded` action.
209
- * WordPress Code Format Fix.
210
- * `CPTP_Module_Permalink` Bug Fix.
211
- * Bug Fix.
212
- * Use Semantic Versioning.
213
- * Date Structure Fix.
214
- * Use Category Base.
215
-
216
- ### 0.9.7
217
-
218
- * Adding date slug only conflicting `%post_id%`.
219
- * Change taxonomy link rewrite rule. Use `post_type`.
220
- * Can change template include custom taxonomy.
221
-
222
- ### 0.9.6
223
-
224
- * Category and author.
225
- * French Transration. Thanks Geoffrey!
226
- * Hierarchial Term Fix.
227
-
228
- ### 0.9.5.6
229
-
230
- * Strict Standard Error Fix.
231
-
232
- ### 0.9.5.4
233
-
234
- * archive link bug fix.
235
- * Tested Up 3.9
236
-
237
- ### 0.9.5.3
238
-
239
- * “/”bug fix.
240
- * taxonomy tmplate bug fix.
241
-
242
- ### 0.9.5.2
243
-
244
- * Archives Rewrite Fix.
245
-
246
- ### 0.9.5.1
247
-
248
- * Admin Bug Fix.
249
-
250
- ### 0.9.5
251
-
252
- * Big change plugin architecture.
253
- * Show `has_archive`, `with_front`.
254
-
255
- ### 0.9.4
256
-
257
- * Internal release.
258
-
259
- ### 0.9.3.3
260
-
261
- * `has_archive` Bug Fix.
262
- * Fixed a bug in the link, including the extension.
263
-
264
- ### 0.9.3.2
265
-
266
- * `wp_get_archives` Bug Fix.
267
-
268
- ### 0.9.3.1
269
-
270
- * Tested 3.6
271
- * Bug Fix.
272
-
273
-
274
- ### 0.9.3
275
-
276
- * Admin page fix.
277
- * slngle pageing link fix.
278
- * Add Russian translation.
279
-
280
-
281
- ### 0.9
282
-
283
- * Add custom post type archive only `has_archive` is `true`.
284
- * Change method name.
285
- * Change hook custom post link.
286
- * Use Slug in `wp_get_archive()`.
287
- * Fix attachment link.
288
-
289
-
290
- ### 0.8.7
291
-
292
- * Translate Bug Fix.
293
-
294
- ### 0.8.6
295
-
296
- * Paging Bug Fix.
297
- * Commnent Paging.
298
- * Show pointer.
299
- *
300
-
301
- ### 0.8.1
302
-
303
- * Bug Fix.
304
-
305
- ### 0.7.9.1
306
-
307
- * Support Comment permalink.
308
- * Small change in setting page.
309
- * Change default value.
310
- * Bug Fix.
311
-
312
- ### 0.7.8
313
-
314
- * Bug fix.
315
-
316
-
317
- ### 0.7.7
318
-
319
- * Bug fix.
320
-
321
- ### 0.7.6
322
-
323
- * Add parent's slug to hierarchical post type.
324
-
325
-
326
- ### 0.7.5
327
-
328
- * Add ability to disable to change custom taxonomy archive's permalink.
329
-
330
-
331
- ### 0.7.4
332
-
333
- * Bug fix taxonomy rewrite.
334
-
335
-
336
- ### 0.7.3
337
-
338
- * Changed part for saving the data.
339
-
340
- ### 0.7.2
341
-
342
- * Reweite bug fix.
343
- * Prewview bug fix.
344
-
345
- ### 0.7.1
346
-
347
- * Bug fix.
348
-
349
- ### 0.7
350
-
351
- * Add `%{taxonomy}%` tag.
352
- * A large number of Bug Fix.
353
- * Change Setting Page. Use Setting API.
354
-
355
-
356
- ### 0.6.2
357
-
358
- * Fix `%author%` tag.
359
-
360
- ### 0.6
361
-
362
- * First release on wordpress.org
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,15 +1,20 @@
1
  === Custom Post Type Permalinks ===
2
- Contributors: Toro_Unit,inc2734,ixkaito,keita_kobayashi
3
- Donate link: https://www.paypal.me/torounit
4
- Tags: permalink,permalinks,custom post type,custom taxonomy,cms
5
- Requires at least: 4.3
6
- Tested up to: 5.4
7
- Requires PHP: 5.3
8
- Stable tag: 3.3.5
9
- License: GPLv2 or Later
 
 
 
10
 
11
  Edit the permalink of custom post type.
12
 
 
 
13
  == Description ==
14
 
15
  Custom Post Type Permalinks allow you edit the permalink structure of custom post type.
@@ -24,6 +29,7 @@ Donation: Please send [My Wishlist](http://www.amazon.co.jp/registry/wishlist/CO
24
 
25
 
26
  = Translators =
 
27
  * Japanese(ja) - [Toro_Unit](http://www.torounit.com/)
28
  * French(fr_FR) - [Geoffrey Crofte](http://geoffrey.crofte.fr/)
29
  * Russian(ru_RU) - [Olart](http://olart.ru), [Natali_Z](https://profiles.wordpress.org/natali_z)
@@ -37,8 +43,7 @@ Donation: Please send [My Wishlist](http://www.amazon.co.jp/registry/wishlist/CO
37
 
38
  Example:
39
 
40
- `
41
- register_post_type( 'foo',
42
  array(
43
  'public' => true,
44
  'has_archive' => true,
@@ -47,9 +52,20 @@ register_post_type( 'foo',
47
  ),
48
  'cptp_permalink_structure' => '%post_id%'
49
  )
50
- );
51
- `
 
 
 
 
 
52
 
 
 
 
 
 
 
53
 
54
  == Installation ==
55
 
@@ -65,26 +81,37 @@ That's it. You can access the permalinks setting by going to *Settings -> Permal
65
 
66
  * screenshot-1.png
67
 
68
-
69
  == Changelog ==
70
 
 
 
 
 
 
 
 
71
  = 3.3.5 =
 
72
  * Tested 5.4
73
  * fix CPTP_Module_Permalink::post_type_link.
74
 
75
  = 3.3.1 =
 
76
  * Add disable option for date / author and post type archive.
77
  * Bug fix for `parse_request`.
78
 
79
  = 3.2.2 =
 
80
  * Fix readme.txt
81
 
82
  = 3.2.0 =
 
83
  * Support only public post type.
84
  * Add `CPTP_is_rewrite_supported_by_${post_type}` and `CPTP_is_rewrite_supported` filter.
85
  * Remove post_type query wp_get_archives.
86
 
87
  = 3.1.4 =
 
88
  * Test for WordPress 4.9.
89
  * PHPCS fix.
90
 
1
  === Custom Post Type Permalinks ===
2
+
3
+ Contributors: Toro_Unit, inc2734, ixkaito, keita_kobayashi, strategio
4
+ Donate link: https://www.paypal.me/torounit
5
+ Tags: permalink, url, link, address, custom post type
6
+ Requires at least: 4.7
7
+ Tested up to: 5.5
8
+ Requires PHP: 5.6
9
+ License: GPLv2 or Later
10
+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt
11
+ Stable tag: 3.3.5
12
+
13
 
14
  Edit the permalink of custom post type.
15
 
16
+
17
+
18
  == Description ==
19
 
20
  Custom Post Type Permalinks allow you edit the permalink structure of custom post type.
29
 
30
 
31
  = Translators =
32
+
33
  * Japanese(ja) - [Toro_Unit](http://www.torounit.com/)
34
  * French(fr_FR) - [Geoffrey Crofte](http://geoffrey.crofte.fr/)
35
  * Russian(ru_RU) - [Olart](http://olart.ru), [Natali_Z](https://profiles.wordpress.org/natali_z)
43
 
44
  Example:
45
 
46
+ <pre>register_post_type( 'foo',
 
47
  array(
48
  'public' => true,
49
  'has_archive' => true,
52
  ),
53
  'cptp_permalink_structure' => '%post_id%'
54
  )
55
+ );</pre>
56
+
57
+ = Exclude specific post type =
58
+
59
+ <pre>add_filter( 'CPTP_is_rewrite_supported_by_foo', '__return_false' );
60
+
61
+ // or
62
 
63
+ add_filter( 'CPTP_is_rewrite_supported', function ( $support , $post_type ) {
64
+ if ( 'foo' === $post_type ) {
65
+ return false;
66
+ }
67
+ return $support;
68
+ }, 10, 2);</pre>
69
 
70
  == Installation ==
71
 
81
 
82
  * screenshot-1.png
83
 
 
84
  == Changelog ==
85
 
86
+ = 3.4.0 =
87
+
88
+ * Tested 5.5 beta3
89
+ * WPML support: custom post type slug translation. ( Props @strategio )
90
+ * Add new filter `cptp_post_link_category` and `cptp_post_link_term` .
91
+ * Use Lowercase prefix for action and filter.
92
+
93
  = 3.3.5 =
94
+
95
  * Tested 5.4
96
  * fix CPTP_Module_Permalink::post_type_link.
97
 
98
  = 3.3.1 =
99
+
100
  * Add disable option for date / author and post type archive.
101
  * Bug fix for `parse_request`.
102
 
103
  = 3.2.2 =
104
+
105
  * Fix readme.txt
106
 
107
  = 3.2.0 =
108
+
109
  * Support only public post type.
110
  * Add `CPTP_is_rewrite_supported_by_${post_type}` and `CPTP_is_rewrite_supported` filter.
111
  * Remove post_type query wp_get_archives.
112
 
113
  = 3.1.4 =
114
+
115
  * Test for WordPress 4.9.
116
  * PHPCS fix.
117
 
screenshot-1.png CHANGED
Binary file