How to call custom function from functions.php in site-wide template files?


I have a custom php file in wp-content/themes/xxxx/modules/custom.php and i want to call function from Functions.php. Right now all my functions (same function) everywhere in different files, because still cannot solve this problem.

I want to create a function in Functions.php and call this function from everywhere in the website. This function will called from another php files (Ajax will not call this function). When I include or require any file (wp-load, wp-blog-header, functions.php are not imported)

I read many forums and tried many ways like


define('WP_USE_THEMES', true);
require( '/opt/bitnami/apps/wordpress/htdocs/wp-blog-header.php' ); 


include (/opt/bitnami/apps/wordpress/htdocs/wp-content/themes/xxx/functions.php);


require($_SERVER['DOCUMENT_ROOT'] . '/wp-load');

etc. I tried many ways but all examples not working.

Is there any way to declare a function in Funtions.php and use everywhere without any problem?.

Bayanaa 2 months 0 Answers 6 views 0

Leave an answer