Wordpress plugins function code

I am trying to make a simple plugin that displays some info in the users profile page ( I have managed this part) but what I am not getting to work is I want to add a function that will check to see if a file exists on in a folder ( I can do this part ) but when I add a function into the plugin code it does not work or stops the page from showing up.

Any help would be great I just need to trigger the function on load of user looking at there profile.

function check_file(){
  if($file == 'me.jpg'){
     //do something


Found the answer

add_action( 'show_user_profile', 'check_file' );

Above line will run the check_file function when user will see the profile.

Tags: Wordpress / Plugins

Similar questions

Docker Wordpress plugins persistence or mapping to local plugins
I am running the latest Docker mac app and have created a new docker-compose.yml in my project directory. (which is my wordpress theme). This is my configuration docker-compose.yml file below... So far i'm finding it awesome. I had a few issues with getting the database to be persistent, and figuring out that wp-content folder needs the owner to be...
docker/wordpress: seperate default plugins from own plugins
Let me try to explain what i want to achieve: I am doing wordpress development and and try to set it up nicely via docker. I have a folder with themes and plugin where i my develop plugins and themes in. This folder also contains Docker files to be able to run them i a container where wordpress is installed via its docker image. So far so good, but...
WordPress will not delete plugins or install any new themes or plugins
I have installed WordPress and the Admin console is working. However any plugin I try to delete will stay no matter what as well as the themes. Any time I try to install a theme I get "Update Failed". If I delete the plugins from within my File Manager in cPanel, my plugins still remain in the admin console of WordPress. My permissions ar...
Is it heavyweight plugins or lots of plugins that make a site slow?
I've often heard that having a lot of plugins will slow down a WordPress site. This makes sense of course, as the more code that executes, the longer it will take. I'm wondering whether the slowness is mostly: a result of the sheer number of plugins? (because WP has to do some processing to locate and load each plugin) a result of having a few slow...
Plugins not showing in dashboard->plugins section
About 60% of plugins that I install don't show up in my plugins section. When I install them it says they're installed, and when I click "activate plugin" it says theres no valid header for the plugin. Navigating to the main plugin section in the dashboard the plugin doesn't show up at all, so I can't activate it from the main plugin page either. W...
Plugins in mu-plugins folder are not loaded
I'm trying to load plugins automatically by putting the plugins into mu-plugins folder. But if the plugin is put in a folder, it isn't loaded. I tried some popular plugins such as W3 Total Cache, WordPress SEO By Yoast, but all of them are not loaded. Does WordPress only loads plugins which are just single files in mu-plugins?

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.