WordPress Functions for Plugins

Plugin Functions

  • plugin_dir_path() – Returns the location of the plugins folder in the server file system.
  • plugins_url() – Returns the web URL of the plugins folder.
  • load_plugin_textdomain() – Loads language files related to a specific plugin.
  • wp_enqueue_style() – Used instead of directly calling <style>’s, ensures no duplicate styles are called.
  • wp_enqueue_script() – Same as above, except for <script>’s.
  • register_post_type() – Add a custom post type to the DB.
    • Must be called before admin_menu and following the after_setup_theme action hooks, the init hook usually works.
    • The custom post type must be twenty or less characters