• Resolved SigalZ

    (@sigalz)


    Hello,

    I am new to WordPress and I have a site with an old version (4.1.40) that I need to upgrade to version 6.5.2.

    After the upgrade I get this error:

    Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, function “cptui_register_my_taxes_collection” not found or invalid function name in C:\wamp64\www\mysite.local\wp-includes\class-wp-hook.php on line 324

    This line is in file: wp-content\themes\HZ\functions.php.

    If I disable it, everything works fine.

    I would like to know if it is ok to disable it, I can’t find what is this code for.
    Is there a different function I should call instead?

    Thank you

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

    (@tw2113)

    The BenchPresser

    Hi @sigalz

    To be certain, the site does have CPTUI installed and active correct?

    That asked, we don’t specifically have a function named that, but the naming convention has me thinking you have/had a “collection” taxonomy that was originally created using CPTUI, and then code that would also register it got copy/pasted elsewhere. Probably the HZ/functions.php file.

    However, based on that error, that function declaration got lost, or is maybe in a different file?

    We make it easy for site owners to technically move away from using CPTUI directly, and still retain all of their established settings, or even treat it as a generator for content types. The biggest question here is going to be where the function went for you.

    Thread Starter SigalZ

    (@sigalz)

    Hi @tw2113,

    Thank you very much for answering me.

    The site has CPTUI installed and active.

    It is an old site that someone else developed.

    I don’t understand your question ‘where the function went for you’?

    What do you mean?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Well, it’s not one we register or make use of for the core plugin. It’s one that we generate for registration export.

    If you visit /wp-admin/admin.php?page=cptui_tools&action=get_code in your admin, you’ll see a bunch of textareas. One that outputs ALL the content types, and then more that export per content type.

    For example, in one of my personal websites where I make use of CPTUI, I have this as one of the exportable items, for a taxonomy i named “book_status”

    function cptui_register_my_taxes_book_status() {
    
    	...
    	
    	register_taxonomy( "book_status", [ "books" ], $args );
    }
    add_action( 'init', 'cptui_register_my_taxes_book_status' );

    Note the naming convention there, alongside your example from the original error: cptui_register_my_taxes_collection.

    So, at some point, the site had a function named that, but it doesn’t any more. Something happened and its not being found, perhaps because it got removed from the functions.php file.

    Hard for me to say from my spot here, as I don’t have access to the code in the install.

    Thread Starter SigalZ

    (@sigalz)

    @tw2113 you are amazing! Thank you so much for the detailed answers.

    From what you say, I will search for this function in all the files of the site before the upgrade, to see if it exists somewhere.

    The fact that everything works after upgrade if I disable it, makes me think it is probably a redundant code that is not actually used.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    We’re rooting for you. That said if you see “collections” listed when visiting say the “Registered Types and Taxes” menu item, it very much may be redundant at this time.

    Thread Starter SigalZ

    (@sigalz)

    Just a quick update, I went and checked the error file on the live site and this error is all this file has, so I guess with the upgrade, this error stops the site from running, when with the old site, it could still work with the error.

    Probably a php version.

    Again, thank you very much

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Upgrade error invalid function’ is closed to new replies.