Post Type Switcher - Version 2.0.1

Version Description

Download this release

Release Info

Developer johnjamesjacoby
Plugin Icon 128x128 Post Type Switcher
Version 2.0.1
Comparing to
See all releases

Code changes from version 2.0.0 to 2.0.1

Files changed (3) hide show
  1. assets/js/quickedit.js +8 -7
  2. post-type-switcher.php +14 -12
  3. readme.txt +5 -1
assets/js/quickedit.js CHANGED
@@ -1,3 +1,4 @@
 
1
  function pts_quick_edit() {
2
 
3
  var $ = jQuery;
@@ -15,14 +16,14 @@ function pts_quick_edit() {
15
 
16
  var
17
 
18
- // editRow is the quick-edit row, containing the inputs that need to be updated
19
- editRow = $( '#edit-' + id ),
20
 
21
- // postRow is the row shown when a book isn't being edited, which also holds the existing values.
22
- postRow = $( '#post-' + id ),
23
-
24
- // get the existing values
25
- post_type = $( '.post_type', postRow ).data( 'post-type' );
26
 
27
  // set the values in the quick-editor
28
  $( 'select[name="pts_post_type"] option[value="' + post_type + '"]', editRow ).attr( 'selected', 'selected' );
1
+ /* global inlineEditPost */
2
  function pts_quick_edit() {
3
 
4
  var $ = jQuery;
16
 
17
  var
18
 
19
+ // editRow is the quick-edit row, containing the inputs that need to be updated
20
+ editRow = $( '#edit-' + id ),
21
 
22
+ // postRow is the row shown when a book isn't being edited, which also holds the existing values.
23
+ postRow = $( '#post-' + id ),
24
+
25
+ // get the existing values
26
+ post_type = $( '.post_type', postRow ).data( 'post-type' );
27
 
28
  // set the values in the quick-editor
29
  $( 'select[name="pts_post_type"] option[value="' + post_type + '"]', editRow ).attr( 'selected', 'selected' );
post-type-switcher.php CHANGED
@@ -16,7 +16,7 @@
16
  * License: GPLv2 or later
17
  * License URI: https://www.gnu.org/licenses/gpl-2.0.html
18
  * Description: Allow switching of a post type while editing a post (in post publish section)
19
- * Version: 2.0.0
20
  * Text Domain: post-type-switcher
21
  * Domain Path: /assets/lang/
22
  */
@@ -388,19 +388,21 @@ final class Post_Type_Switcher {
388
  private static function is_allowed_page() {
389
 
390
  // Only for admin area
391
- if ( ! is_blog_admin() ) {
392
- return false;
393
- }
394
 
395
- // Allowed admin pages
396
- $pages = apply_filters( 'pts_allowed_pages', array(
397
- 'post.php',
398
- 'edit.php',
399
- 'admin-ajax.php'
400
- ) );
 
 
 
 
401
 
402
- // Only show switcher when editing
403
- return (bool) in_array( $GLOBALS['pagenow'], $pages, true );
404
  }
405
 
406
  /**
16
  * License: GPLv2 or later
17
  * License URI: https://www.gnu.org/licenses/gpl-2.0.html
18
  * Description: Allow switching of a post type while editing a post (in post publish section)
19
+ * Version: 2.0.1
20
  * Text Domain: post-type-switcher
21
  * Domain Path: /assets/lang/
22
  */
388
  private static function is_allowed_page() {
389
 
390
  // Only for admin area
391
+ if ( is_blog_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && ( ! empty( $_REQUEST['action'] ) && ( 'inline-save' === $_REQUEST['action'] ) ) ) ) {
 
 
392
 
393
+ // Allowed admin pages
394
+ $pages = apply_filters( 'pts_allowed_pages', array(
395
+ 'post.php',
396
+ 'edit.php',
397
+ 'admin-ajax.php'
398
+ ) );
399
+
400
+ // Only show switcher when editing
401
+ return (bool) in_array( $GLOBALS['pagenow'], $pages, true );
402
+ }
403
 
404
+ // Default to false
405
+ return false;
406
  }
407
 
408
  /**
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: johnjamesjacoby, beatpanda, norcross, stuttter
3
  Tags: post type
4
  Requires at least: 3.0
5
  Tested up to: 4.6
6
- Stable tag: 2.0.0
7
 
8
  A simple way to change a post's type in WordPress
9
 
@@ -61,6 +61,10 @@ It should not. This plugin only changes the 'post_type' property of a post.
61
 
62
  == Changelog ==
63
 
 
 
 
 
64
  = Version 2.0.0 =
65
  * Improved plugin compatibility with WooThemes Sensei
66
  * Filter post arguments vs. hook to save_post
3
  Tags: post type
4
  Requires at least: 3.0
5
  Tested up to: 4.6
6
+ Stable tag: 2.0.1
7
 
8
  A simple way to change a post's type in WordPress
9
 
61
 
62
  == Changelog ==
63
 
64
+ = Version 2.0.1 =
65
+ * Ensure quick-edit works with new procedure
66
+ * Quick-edit "Type" column works again!
67
+
68
  = Version 2.0.0 =
69
  * Improved plugin compatibility with WooThemes Sensei
70
  * Filter post arguments vs. hook to save_post