There might be times when you want to load certain assets like JS and CSS files on your site and you do not or can not use a child theme.

While there are plugins in the WordPress repository for loading files in the head or footer, the problem is they do not offer a way to restrict the loading to certain pages of the site.

This is where a custom functionality plugin comes in handy.

Here is a basic plugin that you could use as a starting point for loading assets in WordPress: My Custom Functionality

Need help implementing a tutorial in your site or want to hire me for custom work?


Find the article helpful and wish to donate?



For adding code blocks wrap the code in three backticks. Markdown should work.
Provide a URL of your site/webpage if something is not working.

53 comments on “A basic WordPress Custom Functionality plugin”

  1. Hey Sridhar,
    I get this Error when trying to use the plugin twice.

    Fatal error: Cannot redeclare custom_enqueue_files() (previously declared in /var/www/vhosts/…/…/…/wp-content/plugins/custom toc/plugin.php:36) in /var/www/vhosts/…/…/…/wp-content/plugins/my-custom-functionality-master/plugin.php on line 49

    Any idea how I could solve this ?


linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
%d bloggers like this: