Call Custom table API from functions.php or non template php scripts

Support MB Custom Table Call Custom table API from functions.php or non template php scriptsResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #39609
    mossmanmossman
    Participant

    Hello,
    When I try to call functions of the custom table API from functions.php or non template php scripts included or not in functions.php I got this error:

    Fatal error: Uncaught Error: Class 'MetaBox\CustomTable\API' not found in /var/www/clients/client3/web58/web/wp-content/themes/generatepress_child/functions.php:45 Stack trace: #0 /var/www/clients/client3/web58/web/wp-settings.php(585): include() #1 /var/www/clients/client3/web58/web/wp-config.php(96): require_once('/var/www/client...') #2 /var/www/clients/client3/web58/web/wp-load.php(50): require_once('/var/www/client...') #3 /var/www/clients/client3/web58/web/wp-blog-header.php(13): require_once('/var/www/client...') #4 /var/www/clients/client3/web58/web/index.php(17): require('/var/www/client...') #5 {main} thrown in /var/www/clients/client3/web58/web/wp-content/themes/generatepress_child/functions.php on line 45

    How I can call custom table API or the regular functions (rwmb_get_value, rwmb_meta...) from functions.php or non template php scripts included or not in functions.php.

    Thank you

    #39631
    PeterPeter
    Moderator

    Hello,

    Can you please share the code that you use to call the API of the custom table? It could be the function is executed before MB Custom Table is loaded. Please try to run it at the init hook and a later priority like 9999.

    #39658
    mossmanmossman
    Participant

    Hello Peter,
    The 9999 priority did the job, thank you!

    We can close the topic.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.