Closed aletp closed 6 years ago
Hi there!
Do you have any security plugins block API endpoints? Gutenberg rely on the REST API, so any plugin altering the endpoints could alter Gutenberg usage.
Similar issue https://github.com/WordPress/gutenberg/issues/6942
Hi, I have see categories menu but I don't category items.
MacOs 10.13.6 68.0.3440.84 (Official Debug) (64 bit) Wordpress 4.9.8 (tr_TR) Gutenberg 3.4.0
@tahsinkandamar do you have CloudFlare enabled? Security plugins?
I wasn't seeing categories or tags and then I disabled my security and they showed back up. Is there a way around getting them to show without losing my security?
@rita3130 Make sure your security plugin doesn't disable or alter REST API endpoints. Most plugins have those options there.
@youknowriad Thank you. Changing that brought them right back for me.
I'm going to close this issue now as it's more likely one of the reasons above:
Let's reopen if we find different causes. Thanks.
I am encountering this same issue, working on a localhost install with Twenty Seventeen, Gutenberg as the only active plugin, and running trunk.
Windows 10.0.17134.228 Google Chrome 68.0.3440.106 (Official Build) (64-bit) (also Firefox (61.0.2) WordPress 5.0-alpha-20180604.123724 Gutenberg 3.6.2
Have checked a REST endpoint and it comes up fine, but I have no categories or tags in Gutenberg (two different machines).
@robincornett Can you check in Chrome's Dev Tools the XHR requests triggered once you open the sidebar in Gutenberg (and their responses?)
@youknowriad, here is what I have--I hope it is what you wanted:
http://local.wordpress-trunk.test/wp-json/wp/v2/users/?who=authors&per_page=-1
[{"id":1,"name":"admin","url":"","description":"","link":"http:\/\/local.wordpress-trunk.test\/author\/admin\/","slug":"admin","avatar_urls":{"24":"http:\/\/0.gravatar.com\/avatar\/92f90103972341af5dcf421661209729?s=24&d=mm&r=g","48":"http:\/\/0.gravatar.com\/avatar\/92f90103972341af5dcf421661209729?s=48&d=mm&r=g","96":"http:\/\/0.gravatar.com\/avatar\/92f90103972341af5dcf421661209729?s=96&d=mm&r=g"},"meta":[],"_links":{"self":[{"href":"http:\/\/local.wordpress-trunk.test\/wp-json\/wp\/v2\/users\/1"}],"collection":[{"href":"http:\/\/local.wordpress-trunk.test\/wp-json\/wp\/v2\/users"}]}}]
http://local.wordpress-trunk.test/wp-json/wp/v2/media/244?context=edit
{"id":244,"date":"2018-08-20T08:37:29","date_gmt":"2018-08-20T12:37:29","guid":{"rendered":"http:\/\/local.wordpress-trunk.test\/build\/wp-content\/uploads\/2018\/08\/max-van-den-oetelaar-646474-unsplash.jpg","raw":"http:\/\/local.wordpress-trunk.test\/build\/wp-content\/uploads\/2018\/08\/max-van-den-oetelaar-646474-unsplash.jpg"},"modified":"2018-08-20T08:37:29","modified_gmt":"2018-08-20T12:37:29","slug":"max-van-den-oetelaar-646474-unsplash","status":"inherit","type":"attachment","link":"http:\/\/local.wordpress-trunk.test\/?attachment_id=244","title":{"raw":"max-van-den-oetelaar-646474-unsplash","rendered":"max-van-den-oetelaar-646474-unsplash"},"author":1,"comment_status":"open","ping_status":"closed","template":"","meta":[],"permalink_template":"http:\/\/local.wordpress-trunk.test\/?attachment_id=244","generated_slug":"max-van-den-oetelaar-646474-unsplash","description":{"raw":"","rendered":"<p class=\"attachment\"><a href='http:\/\/local.wordpress-trunk.test\/build\/wp-content\/uploads\/2018\/08\/max-van-den-oetelaar-646474-unsplash.jpg'><img width=\"360\" height=\"240\" src=\"http:\/\/local.wordpress-trunk.test\/build\/wp-content\/uploads\/2018\/08\/max-van-den-oetelaar-646474-unsplash-360x240.jpg\" class=\"attachment-medium size-medium\" alt=\"\" srcset=\"http:\/\/local.wordpress-trunk.test\/build\/wp-content\/uploads\/2018\/08\/max-van-den-oetelaar-646474-unsplash-360x240.jpg 360w, http:\/\/local.wordpress-trunk.test\/build\/wp-content\/uploads\/2018\/08\/max-van-den-oetelaar-646474-unsplash-768x512.jpg 768w, http:\/\/local.wordpress-trunk.test\/build\/wp-content\/uploads\/2018\/08\/max-van-den-oetelaar-646474-unsplash-1200x800.jpg 1200w\" sizes=\"(max-width: 360px) 100vw, 360px\" \/><\/a><\/p>\n"},"caption":{"raw":"","rendered":""},"alt_text":"","media_type":"image","mime_type":"image\/jpeg","media_details":{"width":4410,"height":2940,"file":"2018\/08\/max-van-den-oetelaar-646474-unsplash.jpg","sizes":{"thumbnail":{"file":"max-van-den-oetelaar-646474-unsplash-150x150.jpg","width":150,"height":150,"mime_type":"image\/jpeg","source_url":"http:\/\/local.wordpress-trunk.test\/build\/wp-content\/uploads\/2018\/08\/max-van-den-oetelaar-646474-unsplash-150x150.jpg"},"medium":{"file":"max-van-den-oetelaar-646474-unsplash-360x240.jpg","width":360,"height":240,"mime_type":"image\/jpeg","source_url":"http:\/\/local.wordpress-trunk.test\/build\/wp-content\/uploads\/2018\/08\/max-van-den-oetelaar-646474-unsplash-360x240.jpg"},"medium_large":{"file":"max-van-den-oetelaar-646474-unsplash-768x512.jpg","width":768,"height":512,"mime_type":"image\/jpeg","source_url":"http:\/\/local.wordpress-trunk.test\/build\/wp-content\/uploads\/2018\/08\/max-van-den-oetelaar-646474-unsplash-768x512.jpg"},"large":{"file":"max-van-den-oetelaar-646474-unsplash-1200x800.jpg","width":1200,"height":800,"mime_type":"image\/jpeg","source_url":"http:\/\/local.wordpress-trunk.test\/build\/wp-content\/uploads\/2018\/08\/max-van-den-oetelaar-646474-unsplash-1200x800.jpg"},"scoreintl-hero":{"file":"max-van-den-oetelaar-646474-unsplash-1800x1200.jpg","width":1800,"height":1200,"mime_type":"image\/jpeg","source_url":"http:\/\/local.wordpress-trunk.test\/build\/wp-content\/uploads\/2018\/08\/max-van-den-oetelaar-646474-unsplash-1800x1200.jpg"},"scoreintl-square":{"file":"max-van-den-oetelaar-646474-unsplash-300x300.jpg","width":300,"height":300,"mime_type":"image\/jpeg","source_url":"http:\/\/local.wordpress-trunk.test\/build\/wp-content\/uploads\/2018\/08\/max-van-den-oetelaar-646474-unsplash-300x300.jpg"},"full":{"file":"max-van-den-oetelaar-646474-unsplash.jpg","width":4410,"height":2940,"mime_type":"image\/jpeg","source_url":"http:\/\/local.wordpress-trunk.test\/build\/wp-content\/uploads\/2018\/08\/max-van-den-oetelaar-646474-unsplash.jpg"}},"image_meta":{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0","keywords":[]}},"post":210,"source_url":"http:\/\/local.wordpress-trunk.test\/build\/wp-content\/uploads\/2018\/08\/max-van-den-oetelaar-646474-unsplash.jpg","_links":{"self":[{"href":"http:\/\/local.wordpress-trunk.test\/wp-json\/wp\/v2\/media\/244"}],"collection":[{"href":"http:\/\/local.wordpress-trunk.test\/wp-json\/wp\/v2\/media"}],"about":[{"href":"http:\/\/local.wordpress-trunk.test\/wp-json\/wp\/v2\/types\/attachment"}],"author":[{"embeddable":true,"href":"http:\/\/local.wordpress-trunk.test\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/local.wordpress-trunk.test\/wp-json\/wp\/v2\/comments?post=244"}],"wp:action-unfiltered_html":[{"title":"The current user can post HTML markup and JavaScript.","targetSchema":{"type":"object","properties":{"unfiltered_html":{"type":"boolean"}}},"href":"http:\/\/local.wordpress-trunk.test\/wp-json\/wp\/v2\/media\/244"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
http://local.wordpress-trunk.test/wp-json/wp/v2/categories?per_page=-1&orderby=count&order=desc&_fields=id%2Cname%2Cparent
[{"id":1,"name":"Uncategorized","parent":0},{"id":4,"name":"Shortcodes","parent":0},{"id":10,"name":"empty","parent":0}]
http://local.wordpress-trunk.test/wp-json/wp/v2/tags?per_page=-1&orderby=count&order=desc&_fields=id%2Cname&search=
[]
http://local.wordpress-trunk.test/wp-json/wp/v2/taxonomies/category?context=edit
{"name":"Categories","slug":"category","capabilities":{"manage_terms":"manage_categories","edit_terms":"edit_categories","delete_terms":"delete_categories","assign_terms":"assign_categories"},"description":"","labels":{"name":"Categories","singular_name":"Category","search_items":"Search Categories","popular_items":null,"all_items":"All Categories","parent_item":"Parent Category","parent_item_colon":"Parent Category:","edit_item":"Edit Category","view_item":"View Category","update_item":"Update Category","add_new_item":"Add New Category","new_item_name":"New Category Name","separate_items_with_commas":null,"add_or_remove_items":null,"choose_from_most_used":null,"not_found":"No categories found.","no_terms":"No categories","items_list_navigation":"Categories list navigation","items_list":"Categories list","most_used":"Most Used","back_to_items":"← Back to Categories","menu_name":"Categories","name_admin_bar":"category"},"types":["post"],"show_cloud":true,"hierarchical":true,"rest_base":"categories","visibility":{"public":true,"publicly_queryable":true,"show_admin_column":true,"show_in_nav_menus":true,"show_in_quick_edit":true,"show_ui":true},"_links":{"collection":[{"href":"http:\/\/local.wordpress-trunk.test\/wp-json\/wp\/v2\/taxonomies"}],"wp:items":[{"href":"http:\/\/local.wordpress-trunk.test\/wp-json\/wp\/v2\/categories"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
http://local.wordpress-trunk.test/wp-json/wp/v2/taxonomies/post_tag?context=edit
{"name":"Tags","slug":"post_tag","capabilities":{"manage_terms":"manage_post_tags","edit_terms":"edit_post_tags","delete_terms":"delete_post_tags","assign_terms":"assign_post_tags"},"description":"","labels":{"name":"Tags","singular_name":"Tag","search_items":"Search Tags","popular_items":"Popular Tags","all_items":"All Tags","parent_item":null,"parent_item_colon":null,"edit_item":"Edit Tag","view_item":"View Tag","update_item":"Update Tag","add_new_item":"Add New Tag","new_item_name":"New Tag Name","separate_items_with_commas":"Separate tags with commas","add_or_remove_items":"Add or remove tags","choose_from_most_used":"Choose from the most used tags","not_found":"No tags found.","no_terms":"No tags","items_list_navigation":"Tags list navigation","items_list":"Tags list","most_used":"Most Used","back_to_items":"← Back to Tags","menu_name":"Tags","name_admin_bar":"post_tag"},"types":["post"],"show_cloud":true,"hierarchical":false,"rest_base":"tags","visibility":{"public":true,"publicly_queryable":true,"show_admin_column":true,"show_in_nav_menus":true,"show_in_quick_edit":true,"show_ui":true},"_links":{"collection":[{"href":"http:\/\/local.wordpress-trunk.test\/wp-json\/wp\/v2\/taxonomies"}],"wp:items":[{"href":"http:\/\/local.wordpress-trunk.test\/wp-json\/wp\/v2\/tags"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
http://local.wordpress-trunk.test/wp-json/wp/v2/categories?per_page=-1&orderby=count&order=desc&_fields=id%2Cname%2Cparent
[{"id":1,"name":"Uncategorized","parent":0},{"id":4,"name":"Shortcodes","parent":0},{"id":10,"name":"empty","parent":0}]
http://local.wordpress-trunk.test/build/wp-admin/admin-ajax.php
{"wp-auth-check":true,"server_time":1534773803}
The categories returned in the next to last request are the correct ones on my localhost (I have no tags).
I don't know if it might be related, but I am also not able to actually publish posts in Gutenberg, only "Submit for Review". On this site, there is only the one admin user. If I edit a previously published post in Gutenberg, I have to submit it for review as well, and have to publish from the Quick Edit menu. I mention this here (have not yet submitted a ticket) in case Gutenberg is possibly misreading my capabilities and messing with terms and publishing as a result?
Can you grab the output of this from your console:
JSON.stringify( wp.select('core/editor').getCurrentPost() )
I expect I am not doing it correctly; when I try to run that, I get:
Uncaught TypeError: wp.select is not a function
I am running it directly from the console in Dev Tools and also as a snippet. Where should I put it instead?
oups sorry
JSON.stringify( wp.data.select('core/editor').getCurrentPost() )
"{"id":210,"date":"2018-08-14T13:30:03","date_gmt":"2018-08-14T17:30:03","guid":"http://local.wordpress-trunk.test/?p=210","modified":"2018-08-20T08:54:27","modified_gmt":"2018-08-20T12:54:27","password":"","slug":"this-is-a-sample-block-post","status":"pending","type":"post","link":"http://local.wordpress-trunk.test/?p=210","title":"This is a Sample Block Post","content":"<!-- wp:image {\"id\":244,\"align\":\"wide\"} -->\n<figure class=\"wp-block-image alignwide\"><img src=\"http://local.wordpress-trunk.test/build/wp-content/uploads/2018/08/max-van-den-oetelaar-646474-unsplash.jpg\" alt=\"\" class=\"wp-image-244\"/></figure>\n<!-- /wp:image -->\n\n<!-- wp:paragraph {\"fontSize\":\"regular\"} -->\n<p class=\"has-regular-font-size\">Now that I've enabled Gutenberg for eTapestry.</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:cover-image {\"url\":\"http://local.wordpress-trunk.test/build/wp-content/uploads/2018/03/ronald-cuyan-434484.jpg\",\"id\":24} -->\n<div class=\"wp-block-cover-image has-background-dim\" style=\"background-image:url(http://local.wordpress-trunk.test/build/wp-content/uploads/2018/03/ronald-cuyan-434484.jpg)\"><p class=\"wp-block-cover-image-text\">This is a cover image.</p></div>\n<!-- /wp:cover-image -->","excerpt":"","author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"permalink_template":"http://local.wordpress-trunk.test/%postname%/","generated_slug":"this-is-a-sample-block-post","_links":{"self":[{"href":"http://local.wordpress-trunk.test/wp-json/wp/v2/posts/210"}],"collection":[{"href":"http://local.wordpress-trunk.test/wp-json/wp/v2/posts"}],"about":[{"href":"http://local.wordpress-trunk.test/wp-json/wp/v2/types/post"}],"author":[{"embeddable":true,"href":"http://local.wordpress-trunk.test/wp-json/wp/v2/users/1"}],"replies":[{"embeddable":true,"href":"http://local.wordpress-trunk.test/wp-json/wp/v2/comments?post=210"}],"version-history":[{"href":"http://local.wordpress-trunk.test/wp-json/wp/v2/posts/210/revisions"}],"wp:attachment":[{"href":"http://local.wordpress-trunk.test/wp-json/wp/v2/media?parent=210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http://local.wordpress-trunk.test/wp-json/wp/v2/categories?post=210"},{"taxonomy":"post_tag","embeddable":true,"href":"http://local.wordpress-trunk.test/wp-json/wp/v2/tags?post=210"}],"wp:action-unfiltered_html":[{"title":"The current user can post HTML markup and JavaScript.","targetSchema":{"type":"object","properties":{"unfiltered_html":{"type":"boolean"}}},"href":"http://local.wordpress-trunk.test/wp-json/wp/v2/posts/210"}],"curies":[{"name":"wp","href":"https://api.w.org/{rel}","templated":true}]}}"```
It looks like the post object is missing some required flags to make Gutenberg work properly. I can't see the wp:action-publish
for instance in the _links
. @danielbachhuber Any idea how this could happen?
What role is the user that's making the request?
Also, user capabilities are stored in the database. If you've modified them in the past, but then deactivated whatever plugin you used to modify them, the changes will remain. Can you use WP-CLI to reset roles?
I don't know if it might be related, but I am also not able to actually publish posts in Gutenberg, only "Submit for Review"
I think this is the root of the problem: something about your user capabilities are misconfigured.
There were capabilities left over from WooCommerce. I installed wp-cli and ran wp role reset --all
, but the issue with categories/tags and the publish button persist.
One unusual thing about my setup locally is that I have an alternative WP_CONTENT_DIR
and WP_CONTENT_URL
set up and, for a handful of sites, use that for themes and plugins. I wondered if this was affecting Gutenberg, so I checked another localhost site which doesn't use the common content directory. Gutenberg worked correctly there.
So I downloaded and installed a fresh install of WP 4.9.8, and checked Gutenberg there using both a unique content directory and then switched it over to use the common one. Gutenberg worked fine in both situations. I wondered if it was an issue with trunk, so I switched my first site back to the 4.9 branch, and Gutenberg is still broken there.
At this point, I guess it is unique to the one site on this machine, but I am experiencing the issue on my other machine as well.
The only user on this site is an administrator role.
Note: both of the affected sites are running trunk from GH and using the new /build/
directory instead of the original /src/
; not sure if that is relevant, but seems like the only other difference I can think of.
Update: I don't think the categories/tags issue and the "Submit for Review" issue are related after all. Another user is experiencing the latter, but not the former (mentioned on Twitter).
Also, I ran a wp db clean
on one machine and reset the content directory and the issue persists there.
Any idea why it's happening? I have blank list.
This is happening to me as well. See davidperegar's screen shot. Also the featured image is also missing.
When creating or editing a new post, the categories are not listed in the sidebar
There is also no longer the top tab to choose the screen options.
MacOS 10.13.6 Google Chrome 67.0.3396.99 Wordpress 4.9.8 (pt_BR) Gutenberg 3.4.0