Taylor Allred
Taylor Allred

Reputation: 4380

How do you find the php file a function is defined in in wordpress?

I'm a newbie at WordPress PHP.

I'm looking in the header.php file and it's calling:

<?php suffusion_before_page(); ?>

For this function and any other function in WordPress/PHP how do I find which file that function is being defined?

Upvotes: 2

Views: 2181

Answers (4)

Morshedul Arefin
Morshedul Arefin

Reputation: 1538

If you are using Windows OS, then you can use GrepWin. Check the screenshots how to use this:

Selecting folder to search by grepwin: Selecting folder to search by grepwin

Using search string in the textbox to search: Using search string in the textbox to search

Grepwin Download Link

Upvotes: 1

Shahar
Shahar

Reputation: 1677

If you use Windows you can enter something like this to command prompt:

find /c /i "function suffusion_before_page(" C:\path\to\wordpress\folder\*.* | find ": 0" /v

Change the path, of course.

Upvotes: 0

Sam B.
Sam B.

Reputation: 303

Look in your hosting cPanel site under your site directory with the rest of your files for your site. The file name is suffusion_before_page.php, which is what you should look for.

You can try and go to www.yoursite.com/wp-admin/theme-editor.php, and then control + f to bring up the search function in browser. Type in "suffusion_before_page.php", then click that file and you can see it.

Upvotes: 0

Mathew Tinsley
Mathew Tinsley

Reputation: 6976

If you have SSH access to the server you can use grep to find the function definition.

grep -R 'function suffusion_before_page' /path/to/theme

If you don't you can download the theme files and search for it using a program of your choice. Notepad++ has a find in files feature.

Upvotes: 1

Related Questions