Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6994123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:51:08+00:00 2026-05-27T19:51:08+00:00

How can I write a plugin that only intents to provide the class to

  • 0

How can I write a plugin that only intents to provide the class to be called by other plugins.
for example, if I have a class like this:

class Test{
     public static function testMethod(){}
}

then within wordpress envrionement, we will be able to call Test::testMethod();

Does the following works?

<?php
/*
 Plugin Name: My Plugin
 ...other WP plugin headers
*/
add_action('init', 'test_init', 0);
function test_init(){
    $test=new Test();
}

class Test{
   public static function testMethod(){}  
}
?>

I don’t think this is a right way to do it. any input is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:51:08+00:00Added an answer on May 27, 2026 at 7:51 pm

    You wouldn’t need the add_action – just activating the plug-in would cause WP to include the class, and a static function like that would then be available.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I know I can write my own HTML-encoding function like this: function getHTMLEncode(t)
I have used this tutorial to make a website, but I would like that
I'd like to write a plugin that does something with the currently edited file
I have a custom plugin (I didn't write it) that is not working on
I'm writing an app where 3rd party vendors can write plugin DLLs and drop
Can someone please explain how you can write a url pattern and view that
In SQL one can write a query that searches for a name of a
Would it be possible to write Eclipse plugin, that: Whenever in our code we
I have something like this on a $.ajax() success function: var popup = window.open('',titulo,menubar=0,location=0,height=500,width=800);
This is my first attempt to write a jQuery plugin, this one is supposed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.