• Resolved gpsc

    (@gpsc)


    I been using the plugin with success to organize a website. Everything was working fine.

    After that i installed a new theme with demo data, and i lost the custom post type that i create before.

    If i try to create again a new custom post tipe i have this error:

    Warning: array_key_exists() expects parameter 2 to be array, string given in ../public_html/wp-content/plugins/custom-post-type-ui/inc/post-types.php on line 1892

    Warning: Illegal string offset ‘tessuti’ in ../public_html/wp-content/plugins/custom-post-type-ui/inc/post-types.php on line 1725

    Warning: Cannot modify header information – headers already sent by (output started at ../public_html/wp-content/plugins/custom-post-type-ui/inc/post-types.php:1892) in ../public_html/wp-includes/functions.php on line 6712"

    I try to create a new name field, delete and reinstall the plugin that nothing change.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hmm.

    This error from post-types.php line 1892 is coming from a function we’re using to prevent duplicate post type slugs. Not saying you’re trying to do that, but one of the parameters passed into the callback is not an array like expected.

    array_key_exists() expects parameter 2 to be array
    

    Meanwhile this error is coming from when trying to save a post type.

    Warning: Illegal string offset ‘tessuti’ in ../public_html/wp-content/plugins/custom-post-type-ui/inc/post-types.php on line 1725
    

    So some quick questions. The post type(s) involved were previously registered via the theme? And now you’re trying to move them into CPTUI? Did you attempt any sort of importing of settings in some way?

    Trying to figure out how these errors could potentially result, especially if CPTUI had been just started using to help with the overall site work.

    Thread Starter gpsc

    (@gpsc)

    Thanks for the quick answer.
    I first install CPT then i install the theme and the the demo data.
    After installing the demo data the custom field was not there anymore so i try to create it again and it generate the error. I try to create a new name custom field and still wasnt working.
    Both the custom fields where original and not as the one in the theme.

    PS i can easily cancell all the installation and do it again, the website was still a demo.
    In witch order i should do the following actions:
    Install the Plugin CPT
    Install the theme
    Install the demo
    Create the custom fields

    Thanks!

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    I don’t think there’s necessarily a specific order needed for this, at least with those steps mentioned.

    CPTUI isn’t going to do anything until you create a post type and/or a taxonomy with it, and we don’t take over for any of those registered elsewhere like in a theme.

    I assume the theme demo is going to have the posts and post meta already “configured” for import into the database, and the custom fields would show when editing their associated posts in the post type. I also assume that the theme is doing all the post type/taxonomy registration already, for which there wouldn’t necessarily be need for CPTUI just yet, unless you have your own content types to add.

    I haven’t seen this part “out in the wild” before, but I’m now suddenly curious if they perhaps have demo data meant specifically for import into our plugin. Though this is just me going crazy with imagination ??

    Thread Starter gpsc

    (@gpsc)

    The demo doenst contain your plugin, i believe they create custom field directly by code.
    The theme is this

    https://themeforest.net/item/wavo-creative-portfolio-agency-theme/26552218

    Im gonna reinstall everyhing from 0 and keep you update if the things will work better

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Sounds good. You know where to find us if you have new questions ??

    Thread Starter gpsc

    (@gpsc)

    Hei, i been try again.
    The problem is realated of the demo and yes, the theme default as your plugin installed.

    So i reset wordpress, install the theme, install the demo data, try to create a custom field with your plugin and here the error:

    Warning: array_key_exists() expects parameter 2 to be array, string given in /home/customer/www/brunom20.sg-host.com/public_html/wp-content/plugins/custom-post-type-ui/inc/post-types.php on line 1892

    Warning: Illegal string offset ‘tessuti’ in /home/customer/www/brunom20.sg-host.com/public_html/wp-content/plugins/custom-post-type-ui/inc/post-types.php on line 1725

    Warning: Cannot modify header information – headers already sent by (output started at /home/customer/www/brunom20.sg-host.com/public_html/wp-content/plugins/custom-post-type-ui/inc/post-types.php:1892) in /home/customer/www/brunom20.sg-host.com/public_html/wp-includes/functions.php on line 6712

    here is the theme that i bought

    https://themeforest.net/item/wavo-creative-portfolio-agency-theme/26552218

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Can you visit https://www.YOURDOMAIN.com/wp-admin/admin.php?page=cptui_tools with your actual domain filled in, and copy/paste me the blob of content on the right hand side?

    For whatever reason something isn’t saving properly for you when you’re creating your post types, and I want to check on potentially what it is and why, and hopefully provide a blob version you can import in that resolves this array_key_exists error.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Ever get this resolved @gpsc ?

    Thread Starter gpsc

    (@gpsc)

    Hei,

    in the end i gave up and installed the demo site in localhost and get the info i need.
    Anyway i just got now the data you ask me, sorry for the delay.
    So far i didnt had more problem, is funny how the exactly same procedures works in localhost.

    {"tessuti":{"name":"tessuti","label":"Tessuti","singular_label":"Tessuto","description":"","public":"true","publicly_queryable":"true","show_ui":"true","show_in_nav_menus":"true","delete_with_user":"false","show_in_rest":"true","rest_base":"","rest_controller_class":"","has_archive":"false","has_archive_string":"","exclude_from_search":"false","capability_type":"post","hierarchical":"true","rewrite":"true","rewrite_slug":"","rewrite_withfront":"true","query_var":"true","query_var_slug":"","menu_position":"","show_in_menu":"true","show_in_menu_string":"","menu_icon":"","supports":["title","editor","thumbnail","page-attributes"],"taxonomies":[],"labels":{"menu_name":"My Tessuti","all_items":"All Tessuti","add_new":"Add new","add_new_item":"Add new tessuto","edit_item":"Edit tessuto","new_item":"New tessuto","view_item":"View tessuto","view_items":"View Tessuti","search_items":"Search Tessuti","not_found":"No Tessuti found","not_found_in_trash":"No Tessuti found in trash","parent":"Parent tessuto:","featured_image":"Featured image for this tessuto","set_featured_image":"Set featured image for this tessuto","remove_featured_image":"Remove featured image for this tessuto","use_featured_image":"Use as featured image for this tessuto","archives":"Prodotti","insert_into_item":"Insert into tessuto","uploaded_to_this_item":"Upload to this tessuto","filter_items_list":"Filter Tessuti list","items_list_navigation":"Tessuti list navigation","items_list":"Tessuti list","attributes":"Tessuti attributes","name_admin_bar":"tessuto","item_published":"tessuto published","item_published_privately":"tessuto published privately.","item_reverted_to_draft":"tessuto reverted to draft.","item_scheduled":"tessuto scheduled","item_updated":"tessuto updated.","parent_item_colon":"Parent tessuto:"},"custom_supports":""},"moodboard":{"name":"moodboard","label":"Moodboards","singular_label":"Moodboardz","description":"","public":"true","publicly_queryable":"true","show_ui":"true","show_in_nav_menus":"true","delete_with_user":"false","show_in_rest":"true","rest_base":"","rest_controller_class":"","has_archive":"true","has_archive_string":"","exclude_from_search":"false","capability_type":"post","hierarchical":"false","rewrite":"true","rewrite_slug":"","rewrite_withfront":"true","query_var":"true","query_var_slug":"","menu_position":"","show_in_menu":"true","show_in_menu_string":"","menu_icon":"","supports":["title","editor","thumbnail"],"taxonomies":[],"labels":{"menu_name":"","all_items":"","add_new":"","add_new_item":"","edit_item":"","new_item":"","view_item":"","view_items":"","search_items":"","not_found":"","not_found_in_trash":"","parent_item_colon":"","featured_image":"","set_featured_image":"","remove_featured_image":"","use_featured_image":"","archives":"","insert_into_item":"","uploaded_to_this_item":"","filter_items_list":"","items_list_navigation":"","items_list":"","attributes":"","name_admin_bar":"","item_published":"","item_published_privately":"","item_reverted_to_draft":"","item_scheduled":"","item_updated":""},"custom_supports":""}}

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    If it’s working now and not throwing any of those errors, awesome. I would have needed the version when it still was anyway. Regardless, yay with moving forward with your needs and usecases ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Error array_key_exists() expects parameter 2 to be array’ is closed to new replies.