10up / classifai

Supercharge WordPress Content Workflows and Engagement with Artificial Intelligence.
https://classifaiplugin.com
GNU General Public License v2.0
573 stars 53 forks source link

Trouble using ClassifAI with custom post types #757

Closed MattCViv closed 4 months ago

MattCViv commented 5 months ago

Describe the bug

Features 'Generate Titles' and 'Suggest terms & tags' are not working while editing a draft of a custom post type called Resources. When I click on Generate Titles, an error reading "Sorry, you are not allowed to do that." appears. Meanwhile, the 'Suggest terms & tags' button reloads the page as if it were working, but no tags are generated. Both of these features work with 'normal' Posts.

Steps to Reproduce

  1. Go to the site's WP Engine home page
  2. Click on Resources --> New Post
  3. Enter sample text into the body
  4. Save as a draft
  5. Click 'Generate Titles' to trigger the first error (you are not allowed to do that)
  6. Click 'Suggest terms & tags' to trigger the second error (tags not appearing)

Screenshots, screen recording, code snippet

image image

Environment information

Device: Windows PC and Microsoft Surface Pro, both running Windows 10. ClassifAI version 3.0.1 Provider: IBM Watson NLU Keyword threshold: I tried 70%, 50%, and 1%.

WordPress information

`

wp-core

version: 6.4.3 site_language: en_US user_language: en_US timezone: America/New_York permalink: /%year%/%monthnum%/%day%/%postname%/ https_status: true multisite: true user_registration: true blog_public: 1 default_comment_status: open environment_type: production site_count: 2 network_count: 1 user_count: 59 dotorg_communication: true

wp-dropins (2)

advanced-cache.php: true object-cache.php: true

wp-active-theme

name: vpi (vpi) version: 1.0 author: the Viv Web Solutions team author_website: https://vivwebsolutions.com/ parent_theme: none theme_features: core-block-patterns, widgets, widgets-block-editor, title-tag, post-thumbnails, menus, editor-style theme_path: /nas/content/live/p1statelibrary/wp-content/themes/vpi auto_update: Disabled

wp-themes-inactive (8)

Genesis Block Theme: version: 1.0.0, author: StudioPress, Auto-updates disabled Twenty Nineteen: version: 1.4, author: the WordPress team (latest version: 2.8), Auto-updates disabled Twenty Seventeen: version: 2.2, author: the WordPress team (latest version: 3.6), Auto-updates disabled Twenty Sixteen: version: 2.0, author: the WordPress team (latest version: 3.2), Auto-updates disabled Twenty Twenty: version: 1.1, author: the WordPress team (latest version: 2.6), Auto-updates disabled Twenty Twenty-Four: version: 1.0, author: the WordPress team (latest version: 1.1), Auto-updates disabled Twenty Twenty-Three: version: 1.3, author: the WordPress team (latest version: 1.4), Auto-updates disabled Twenty Twenty-Two: version: 1.6, author: the WordPress team (latest version: 1.7), Auto-updates disabled

wp-mu-plugins (5)

Force Strong Passwords - WPE Edition: version: 1.8.0, author: Jason Cosper WP Engine Cache Plugin: version: 1.3.0, author: WP Engine WP Engine Seamless Login Plugin: version: 1.6.1, author: WP Engine WP Engine Security Auditor: version: 1.1.1, author: wpengine WP Engine System: version: 5.0.1, author: WP Engine

wp-plugins-active (28)

Advanced Custom Fields: version: 5.8.9, author: Elliot Condon, Auto-updates disabled Advanced Custom Fields: Repeater Field: version: 2.1.0, author: Elliot Condon, Auto-updates disabled Classic Editor: version: 1.5, author: WordPress Contributors, Auto-updates disabled ClassifAI: version: 3.0.1, author: 10up, Auto-updates disabled Cookie Notice: version: 1.2.51, author: dFactory, Auto-updates disabled Duplicate Post: version: 3.2.4, author: Enrico Battocchi, Auto-updates disabled Dynamic Widgets: version: 1.5.16, author: Qurl, Auto-updates disabled Embed Video Thumbnail: version: 1.3.1, author: ikanaweb, Auto-updates disabled Enable Media Replace: version: 3.3.11, author: ShortPixel, Auto-updates disabled Gravity Forms: version: 2.4.17.17, author: Gravity Forms (latest version: 2.8.7), Auto-updates disabled Gravity Forms User Registration Add-On: version: 4.4, author: rocketgenius (latest version: 5.3.0), Auto-updates disabled Login or Logout Menu Item: version: 1.2.0, author: cartpauj, Auto-updates disabled Nextend Social Login: version: 3.0.22, author: Nextendweb, Auto-updates disabled NS Cloner - Site Copier: version: 4.0.7, author: Never Settle, Auto-updates disabled PublishPress Capabilities Pro: version: 1.9.8, author: PublishPress (latest version: 2.13.0), Auto-updates disabled PublishPress Revisions Pro: version: 2.2.4, author: PublishPress, Auto-updates disabled Regenerate Thumbnails: version: 3.1.3, author: Alex Mills (Viper007Bond), Auto-updates disabled Relevanssi Premium: version: 2.8.1, author: Mikko Saari (latest version: 2.25.2), Auto-updates disabled Smush Pro: version: 3.6.3, author: WPMU DEV (latest version: 3.16.2), Auto-updates disabled Term Management Tools: version: 1.1.4, author: scribu, Auto-updates disabled Toolset Types: version: 3.5.2, author: OnTheGoSystems, Auto-updates disabled TranslatePress - Multilingual: version: 1.6.9, author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban, Auto-updates disabled WPBakery Page Builder: version: 6.1, author: Michael M - WPBakery.com (latest version: 7.6), Auto-updates disabled wpDiscuz: version: 5.3.5, author: gVectors Team (A. Chakhoyan, G. Zakaryan, H. Martirosyan), Auto-updates disabled WP Engine Automated Migration: version: 5.25, author: WPEngine, Auto-updates disabled WPMU DEV Dashboard: version: 4.11.24, author: WPMU DEV (latest version: 4.11.26), Auto-updates disabled WP show more: version: 1.0.7, author: JAMOS Web Service, Auto-updates disabled Yoast SEO: version: 13.3, author: Team Yoast, Auto-updates disabled

wp-plugins-inactive (8)

3D FlipBook : Dflip Lite: version: 2.2.32, author: DearHive, Auto-updates disabled Akismet Anti-Spam: version: 4.1.4, author: Automattic, Auto-updates disabled Auto Post Thumbnail: version: 3.7.0, author: Creativemotion support@cm-wp.com, Auto-updates disabled Genesis Blocks: version: 3.1.1, author: StudioPress, Auto-updates disabled GS Only PDF Preview: version: 1.0.7, author: gitlost, Auto-updates disabled Relevanssi: version: 4.7.1, author: Mikko Saari, Auto-updates disabled Visual Link Preview: version: 2.0.2, author: Bootstrapped Ventures, Auto-updates disabled WP Engine Site Migration: version: 1.0.0-beta.24, author: WP Engine, Auto-updates disabled

wp-media

image_editor: WP_Image_Editor_Imagick imagick_module_version: 1691 imagemagick_version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org imagick_version: 3.6.0 file_uploads: 1 post_max_size: 100M upload_max_filesize: 50M max_effective_size: 50 MB max_file_uploads: 20 imagick_limits: imagick::RESOURCETYPE_AREA: 137 MB imagick::RESOURCETYPE_DISK: 1073741824 imagick::RESOURCETYPE_FILE: 6144 imagick::RESOURCETYPE_MAP: 512 MB imagick::RESOURCETYPE_MEMORY: 256 MB imagick::RESOURCETYPE_THREAD: 1 imagick::RESOURCETYPE_TIME: 9.22337203685E+18 imagemagick_file_formats: 3FR, 3G2, 3GP, AAI, AI, APNG, ART, ARW, AVI, AVIF, AVS, BGR, BGRA, BGRO, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CR3, CRW, CUR, CUT, DATA, DCM, DCR, DCX, DDS, DFONT, DJVU, DNG, DOT, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FILE, FITS, FRACTAL, FTP, FTS, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, GV, H, HALD, HDR, HEIC, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, J2C, J2K, JBG, JBIG, JNG, JNX, JP2, JPC, JPE, JPEG, JPG, JPM, JPS, JPT, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAGICK, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, POCKETMOD, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIDEO, VIFF, VIPS, VST, WBMP, WEBM, WEBP, WMF, WMV, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, YCbCr, YCbCrA, YUV gd_version: 2.3.0 gd_formats: GIF, JPEG, PNG, WebP, BMP, XPM ghostscript_version: unknown

wp-server

server_architecture: Linux 5.4.0-1123-gcp x86_64 httpd_software: Apache php_version: 7.4.33.4 64bit php_sapi: apache2handler max_input_variables: 10000 time_limit: 3600 memory_limit: 512M max_input_time: 3600 upload_max_filesize: 50M php_post_max_size: 100M curl_version: 7.81.0 OpenSSL/3.0.2 suhosin: false imagick_availability: true pretty_permalinks: true htaccess_extra_rules: false current: 2024-04-12T00:05:16+00:00 utc-time: Friday, 12-Apr-24 00:05:16 UTC server-time: 2024-04-11T20:05:12-04:00

wp-database

extension: mysqli server_version: 8.0.36-28 client_version: mysqlnd 7.4.33.4 max_allowed_packet: 16777216 max_connections: 500

wp-constants

WP_HOME: undefined WP_SITEURL: undefined WP_CONTENT_DIR: /nas/content/live/p1statelibrary/wp-content WP_PLUGIN_DIR: /nas/content/live/p1statelibrary/wp-content/plugins WP_MEMORY_LIMIT: 64M WP_MAX_MEMORY_LIMIT: 512M WP_DEBUG: false WP_DEBUG_DISPLAY: true WP_DEBUG_LOG: false SCRIPT_DEBUG: false WP_CACHE: true CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_ENVIRONMENT_TYPE: Undefined WP_DEVELOPMENT_MODE: undefined DB_CHARSET: utf8 DB_COLLATE: utf8_unicode_ci

wp-filesystem

wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable mu-plugins: writable

classifai

0: 3.0.1 1: yes 2: mattc@vivwebsolutions.com 3: Authenticated: Yes Status: Enabled Allowed roles (titles): administrator, editor, author, contributor, wpseo_manager, wpseo_editor, revisor Allowed users (titles): 61, 9, 2, 49, 51 User based opt-out: Disabled Provider: ibm_watson_nlu Category (status): Enabled Category (threshold): Enabled Category (taxonomy): Enabled Keyword (status): Enabled Keyword (threshold): Enabled Keyword (taxonomy): Enabled Entity (status): Disabled Entity (threshold): Enabled Entity (taxonomy): Enabled Concept (status): Disabled Concept (threshold): Enabled Concept (taxonomy): Enabled Latest response: {"usage":{"text_units":1, "text_characters":2203, "features":2}, "language":"en", "keywords":10, "categories":1} 4: Authenticated: Yes Status: Enabled Allowed roles (titles): administrator, editor, author, contributor, wpseo_manager, wpseo_editor, revisor Allowed users (titles): 61, 9 User based opt-out: Disabled Provider: openai_chatgpt No. of titles: 3 Generate title prompt: [{"title":"ClassifAI default","prompt":"Write an SEO-friendly title for the following content that will encourage readers to clickthrough, staying within a range of 40 to 60 characters.","default":1,"original":1}] Latest response: {"id":"chatcmpl-9CxdNxW821dIxq5IvYNVFsDffJcYY", "object":"chat.completion", "created":1712876197, "model":"gpt-3.5-turbo-0125", "choices":[{"index":0, "message":{"role":"assistant", "content":"\"Understanding Sleep Disorders: Causes, Symptoms & Types\""}, "logprobs":null, "finish_reason":"stop"},{"index":1, "message":{"role":"assistant", "content":"\"Understanding Sleep Disorders: Types, Symptoms & Treatments\""}, "logprobs":null, "finish_reason":"stop"},{"index":2, "message":{"role":"assistant", "content":"\"Understanding Sleep Disorders: Symptoms and Types\""}, "logprobs":null, "finish_reason":"stop"}], "usage":{"prompt_tokens":453, "completion_tokens":32, "total_tokens":485}, "system_fingerprint":"fp_b28b39ffa8"} 5: Authenticated: Yes Status: Enabled Allowed roles (titles): administrator, editor, author, contributor, wpseo_manager, wpseo_editor, revisor Allowed users (titles): 61, 9 User based opt-out: Disabled Provider: openai_chatgpt Excerpt length: 100 Generate excerpt prompt: [{"title":"ClassifAI default","prompt":"Summarize the following message using a maximum of {{WORDS}} words. Ensure this summary pairs well with the following text: {{TITLE}}.","default":1,"original":1}] Latest response: N/A 6: Authenticated: No Status: Disabled Allowed roles (titles): administrator, editor, author, contributor, wpseo_manager, wpseo_editor, revisor Allowed users (titles): User based opt-out: Disabled Provider: openai_chatgpt No. of suggestions: 1 Expand text prompt: [{"title":"ClassifAI default","prompt":"Increase the content length no more than 2 to 4 sentences.","original":1}] Condense text prompt: [{"title":"ClassifAI default","prompt":"Decrease the content length no more than 2 to 4 sentences.","original":1}] Latest response: N/A 7: Authenticated: No Status: Disabled Allowed roles (titles): administrator, editor, author, contributor, wpseo_manager, wpseo_editor, revisor Allowed users (titles): User based opt-out: Disabled Provider: ms_azure_text_to_speech Allowed post types: Voice: Latest response - Voices: N/A 8: Authenticated: No Status: Disabled Allowed roles (titles): administrator, editor, author, contributor, wpseo_manager, wpseo_editor, revisor Allowed users (titles): User based opt-out: Disabled Provider: openai_whisper Latest response: N/A 9: Authenticated: No Status: Disabled Allowed roles (titles): administrator, editor, author, contributor, wpseo_manager, wpseo_editor, revisor Allowed users (titles): User based opt-out: Disabled Provider: openai_moderation Content to Moderate: Latest response: N/A 10: Authenticated: No Status: Disabled Allowed roles (titles): administrator, editor, author, contributor, wpseo_manager, wpseo_editor, revisor Allowed users (titles): User based opt-out: Disabled Provider: ms_computer_vision Generate descriptive text: 0, 0, 0 Confidence threshold: 55 Latest response:: N/A 11: Authenticated: No Status: Disabled Allowed roles (titles): administrator, editor, author, contributor, wpseo_manager, wpseo_editor, revisor Allowed users (titles): User based opt-out: Disabled Provider: ms_computer_vision Tag taxonomy: image_tags Confidence threshold: 70 Latest response:: N/A 12: Authenticated: No Status: Disabled Allowed roles (titles): administrator, editor, author, contributor, wpseo_manager, wpseo_editor, revisor Allowed users (titles): User based opt-out: Disabled Provider: ms_computer_vision Latest response:: N/A 13: Authenticated: No Status: Disabled Allowed roles (titles): administrator, editor, author, contributor, wpseo_manager, wpseo_editor, revisor Allowed users (titles): User based opt-out: Disabled Provider: ms_computer_vision Latest response:: N/A 14: Authenticated: No Status: Disabled Allowed roles (titles): administrator, editor, author, wpseo_manager, wpseo_editor Allowed users (titles): User based opt-out: Disabled Provider: openai_dalle Number of images: 1 Quality: standard Size: 1024x1024 Style: vivid Latest response:: N/A 15: Authenticated: No Status: Disabled Allowed roles (titles): administrator, editor, author, contributor, wpseo_manager, wpseo_editor, revisor Allowed users (titles): User based opt-out: Disabled Provider: ms_computer_vision Latest response:: N/A 16: Authenticated: No Status: Disabled Allowed roles (titles): administrator, editor, author, contributor, wpseo_manager, wpseo_editor, revisor Allowed users (titles): User based opt-out: Disabled Provider: ms_azure_personalizer API URL: Latest response: N/A

`

Code of Conduct

dkotter commented 5 months ago

@MattCViv Thanks for the report. For the first issue (the Sorry, you are not allowed to do that message when generating a title), this isn't a message that ClassifAI produces itself but we do have custom permission checks whenever one of our custom REST endpoints is used (in this case, the generate-title endpoint). This permission check will either return true, false or an error message. If it returns false, WordPress Core will then show the error you're seeing.

This permission check only returns false in two scenarios:

  1. The current user doesn't have permission to edit the item
  2. The post type is not allowed in REST endpoints

Since you're on the edit screen for the Resources post type, that should rule out that first scenario. So I believe the problem here is the Resources post type you're using does not have the show_in_rest argument set to true, which is needed for a post type to be used in REST requests.

Do you happen to know how the Resources post type is being registered? Is that something you're doing or is another plugin adding that?

dkotter commented 5 months ago

And I forgot to mention that if this is the case, that the Resources post type does not have show_in_rest to true, this would also cause the Suggest terms & tags functionality to fail, so I think both of these issues are caused by the same thing.

github-actions[bot] commented 4 months ago

It has been 7 days since more information was requested from you in this issue and we have not heard back. This issue is now marked as stale and will be closed in 7 days, but if you have more information to add then please comment and the issue will stay open.

github-actions[bot] commented 4 months ago

This issue has been automatically closed because there has been no response to our request for more information. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further. See this blog post on bug reports and the importance of repro steps for more information about the kind of information that may be helpful.