Cannot drag custom post types
-
I’ve enabled my custom post types in the settings and the folders panel shows up when viewing them, but I cannot drag any posts to them. I can do so with regular posts, though. I’ve disabled several other plugins except Gravity Forms, Advanced Custom Fields, and WP-Migrate (which are essential to the site) but the plugin still does not work.
-
Hi @solerous,
Sorry to hear you’re having trouble.
When you hover over one of your custom post type items, does the “move” icon show up in the first column (like it does for posts)? If so, what happens when you try to drag it to a folder?
How did you create the custom post type? Did you use a plugin or did you register it yourself via
register_post_type
?Thanks for the quick response. There is no cross when I hover. I created these custom post types using a child theme and register_post_type.
If you visit the admin page for your custom post types and click “Screen Options” in the upper right, is there a “Move to Folder” column?
I assume you registered the post type in the child theme’s functions.php file? If so, is it within a WordPress action such as
init
?Would it be possible for you to paste the code that is used to register the post type so I can try it?
There is no option for Move to Folder in Screen Options.
I do see the option to add it like a taxonomy in the post on the right hand side under Categories.
I did not register the post type using a specific function. It’s just defined in functions.php like so:
// app Custom Post Type $labels = array( "name" => __( 'App', '' ), "singular_name" => __( 'App', '' ), "menu_name" => __( 'Apps', '' ), "all_items" => __( 'All Apps', '' ), "add_new" => __( 'Add New', '' ), "add_new_item" => __( 'Add New App', '' ), "edit_item" => __( 'Edit App', '' ), "new_item" => __( 'New App', '' ), "view_item" => __( 'View App', '' ), "search_items" => __( 'Search App', '' ), "not_found" => __( 'No Apps found', '' ), "not_found_in_trash" => __( 'No Apps found in Trash', '' ), "parent_item_colon" => __( 'Parent App', '' ), "featured_image" => __( 'Featured image for this App', '' ), "set_featured_image" => __( 'Set featured image for this App', '' ), "remove_featured_image" => __( 'Remove featured image for this app', '' ), "use_featured_image" => __( 'Use as featured image for this app', '' ), "archives" => __( 'App archvies', '' ), "insert_into_item" => __( 'Insert into page', '' ), "uploaded_to_this_item" => __( 'Uploaded to this page', '' ), "filter_items_list" => __( 'Filter App list', '' ), "items_list_navigation" => __( 'App list navigation', '' ), "items_list" => __( 'App list', '' ), ); $args = array( "label" => __( 'App', '' ), "labels" => $labels, "description" => "ECP email app posts", "public" => true, "publicly_queryable" => true, "show_ui" => true, "show_in_rest" => false, "rest_base" => "", "has_archive" => true, "show_in_menu" => true, "exclude_from_search" => false, "capability_type" => "post", "map_meta_cap" => true, "hierarchical" => true, "rewrite" => array( "slug" => "app", "with_front" => true ), "query_var" => true, "menu_position" => 5,"menu_icon" => "dashicons-welcome-write-blog", "supports" => array( "title", "thumbnail", "excerpt" ), "taxonomies" => array( "app_cats" ), ); register_post_type( "app", $args );
Thanks for the additional info. So far I’m not having any luck reproducing the issue for some reason.
Can you try moving the post type registration into an init action to see if that makes a difference? If that still doesn’t work, can you try changing the
priority
parameter of yourinit
action, once to -100 and then try again using 100?Let me know if that makes a difference.
FYI, I’m going to be out of the office the rest of the day but will continue looking into this later tonight or tomorrow.
I tried that and it still didn’t work. Doing it at 100 threw some warnings with the nav-walker and other elements.
Notice: Trying to get property 'term_id' of non-object in /Users/de8/htdocs/ecp-proxy/wp-includes/class-wp-walker.php on line 136 Notice: Trying to get property 'name' of non-object in /Users/de8/htdocs/ecp-proxy/wp-includes/class-walker-category-dropdown.php on line 58 Notice: Trying to get property 'term_id' of non-object in /Users/de8/htdocs/ecp-proxy/wp-includes/class-walker-category-dropdown.php on line 66 Notice: Trying to get property 'term_id' of non-object in /Users/de8/htdocs/ecp-proxy/wp-includes/class-walker-category-dropdown.php on line 69 App list navigation55 items ? ? Current Page of 3 Next page? Last page?
I also disabled all plugins except this and it still did not work. Insp
Here’s some of the html from the page where its working (a single row in the post table):
<tr id="post-745" class="iedit author-self level-0 post-745 type-post status-publish format-standard hentry category-uncategorized"> <td class="wicked_move column-wicked_move" data-colname="Move to Folder"><div class="wicked-move-multiple ui-draggable ui-draggable-handle" data-object-id="745"><span class="wicked-move-file dashicons dashicons-move"></span><div class="wicked-items"><div data-object-id="745">Test Summary</div></div></div></td><th scope="row" class="check-column"> <label class="screen-reader-text" for="cb-select-745">Select Test Summary</label> <input id="cb-select-745" type="checkbox" name="post[]" value="745"> <div class="locked-indicator"> <span class="locked-indicator-icon" aria-hidden="true"></span> <span class="screen-reader-text">“Test Summary” is locked</span> </div> </th><td class="title column-title has-row-actions column-primary page-title" data-colname="Title"><div class="locked-info"><span class="locked-avatar"></span> <span class="locked-text"></span></div> <strong><a class="row-title" href="https://localhost/ecp-proxy/wp-admin/post.php?post=745&action=edit" aria-label="“Test Summary” (Edit)">Test Summary</a></strong> <div class="hidden" id="inline_745"> <div class="post_title">Test Summary</div><div class="post_name">test-summary</div> <div class="post_author">1</div> <div class="comment_status">closed</div> <div class="ping_status">open</div> <div class="_status">publish</div> <div class="jj">12</div> <div class="mm">03</div> <div class="aa">2019</div> <div class="hh">15</div> <div class="mn">27</div> <div class="ss">45</div> <div class="post_password"></div><div class="page_template">default</div><div class="post_category" id="category_745">1</div><div class="tags_input" id="post_tag_745"></div><div class="post_category" id="wf_post_folders_745"></div><div class="sticky"></div><div class="post_format"></div></div><div class="row-actions"><span class="edit"><a href="https://localhost/ecp-proxy/wp-admin/post.php?post=745&action=edit" aria-label="Edit “Test Summary”">Edit</a> | </span><span class="inline hide-if-no-js"><a href="#" class="editinline" aria-label="Quick edit “Test Summary” inline">Quick Edit</a> | </span><span class="trash"><a href="https://localhost/ecp-proxy/wp-admin/post.php?post=745&action=trash&_wpnonce=728d21f92a" class="submitdelete" aria-label="Move “Test Summary” to the Trash">Trash</a> | </span><span class="view"><a href="https://localhost/ecp-proxy/test-summary/" rel="bookmark" aria-label="View “Test Summary”">View</a></span></div><button type="button" class="toggle-row"><span class="screen-reader-text">Show more details</span></button></td><td class="author column-author" data-colname="Author"><a href="edit.php?post_type=post&author=1">siteAdmin</a></td><td class="categories column-categories" data-colname="Categories"><a href="edit.php?category_name=uncategorized">Uncategorized</a></td><td class="tags column-tags" data-colname="Tags"><span aria-hidden="true">—</span><span class="screen-reader-text">No tags</span></td><td class="taxonomy-wf_post_folders column-taxonomy-wf_post_folders" data-colname="Summary Folders"><span aria-hidden="true">—</span><span class="screen-reader-text">No categories</span></td><td class="comments column-comments" data-colname="Comments"> <div class="post-com-count-wrapper"> <span aria-hidden="true">—</span><span class="screen-reader-text">No comments</span><span class="post-com-count post-com-count-pending post-com-count-no-pending"><span class="comment-count comment-count-no-pending" aria-hidden="true">0</span><span class="screen-reader-text">No comments</span></span> </div> </td><td class="date column-date" data-colname="Date">Published<br><abbr title="2019/03/12 3:27:45 pm">2019/03/12</abbr></td> </tr>
Here’s the html for a row in the custom post table:
<tr id="post-724" class="iedit author-other level-0 post-724 type-app status-publish hentry"> <td class="wicked_move column-wicked_move" data-colname="Move to Folder"></td><th scope="row" class="check-column"> <label class="screen-reader-text" for="cb-select-724">Select Comb</label> <input id="cb-select-724" type="checkbox" name="post[]" value="724"> <div class="locked-indicator"> <span class="locked-indicator-icon" aria-hidden="true"></span> <span class="screen-reader-text">“Comb” is locked</span> </div> </th><td class="title column-title has-row-actions column-primary page-title" data-colname="Title"><div class="locked-info"><span class="locked-avatar"></span> <span class="locked-text"></span></div> <strong><a class="row-title" href="https://localhost/ecp-proxy/wp-admin/post.php?post=724&action=edit" aria-label="“Comb” (Edit)">Comb</a></strong> <div class="hidden" id="inline_724"> <div class="post_title">Comb</div><div class="post_name">comb</div> <div class="post_author">10</div> <div class="comment_status">closed</div> <div class="ping_status">closed</div> <div class="_status">publish</div> <div class="jj">08</div> <div class="mm">02</div> <div class="aa">2019</div> <div class="hh">20</div> <div class="mn">34</div> <div class="ss">40</div> <div class="post_password"></div><div class="post_parent">0</div><div class="page_template">default</div><div class="post_category" id="app_cats_724"></div></div><div class="row-actions"><span class="edit"><a href="https://localhost/ecp-proxy/wp-admin/post.php?post=724&action=edit" aria-label="Edit “Comb”">Edit</a> | </span><span class="inline hide-if-no-js"><a href="#" class="editinline" aria-label="Quick edit “Comb” inline">Quick Edit</a> | </span><span class="trash"><a href="https://localhost/ecp-proxy/wp-admin/post.php?post=724&action=trash&_wpnonce=328f5c9f03" class="submitdelete" aria-label="Move “Comb” to the Trash">Trash</a> | </span><span class="view"><a href="https://localhost/ecp-proxy/app/comb/" rel="bookmark" aria-label="View “Comb”">View</a></span></div><button type="button" class="toggle-row"><span class="screen-reader-text">Show more details</span></button></td><td class="taxonomy-app_cats column-taxonomy-app_cats" data-colname="Categories"><span aria-hidden="true">—</span><span class="screen-reader-text">No Categories</span></td><td class="date column-date" data-colname="Date">Published<br><abbr title="2019/02/08 8:34:40 pm">2019/02/08</abbr></td> </tr>
Thanks again for the additional info, that’s very helpful. I still haven’t figured out a way to reproduce the issue though. Is there any chance you could send me a link to a zip of your theme files (the main theme and the child theme)? If you don’t want to post it publicly, you could send it via our contact page.
Thanks for looking into it. The contact form you linked does not accept files in zip format. The theme I’m using is a free one available at https://colorlib.com/wp/themes/dazzling/
Is there some other way I can get you the child theme let me know.
Thanks @solerous. I’ve enabled zip uploads on the contact form. Would you mind trying again?
The files have been sent.
Hi @solerous,
Thanks for sending the files and your help with this.
Can you please try changing the priority of your
init
action to 10 and adding the following code to the end of yourfunctions.php
file:$wicked_folders_admin = Wicked_Folders_Admin::get_instance(); add_action( 'manage_pages_custom_column', array( $wicked_folders_admin, 'page_custom_column_content' ), 10, 2 );
I’m hoping this will fix it. Let me know.
That did it! Phew. Thanks for all the hard work in getting this working. If my client approves, I will definitely be getting the pro version.
Great, glad to hear that worked! That’s for all your help troubleshooting the issue.
BTW, here is a slightly different version of the previous code snippet that prevents an error from occurring if the plugin is deactivated:
if ( class_exists( 'Wicked_Folders_Admin' ) ) { $wicked_folders_admin = Wicked_Folders_Admin::get_instance(); add_action( 'manage_pages_custom_column', array( $wicked_folders_admin, 'page_custom_column_content' ), 10, 2 ); }
- The topic ‘Cannot drag custom post types’ is closed to new replies.