File: //proc/self/root/home/madepabj/gharana.pk/wp-content/plugins/hello-plugin/hello-plugin.php
<?php
/**
* Plugin Name: Hello Plugin
* Plugin URI: https://example.com/
* Description: A simple demo plugin for testing upload & activation.
* Version: 1.0
* Author: ChatGPT
* Author URI: https://openai.com/
*/
if (!defined('ABSPATH')) {
exit;
}
register_activation_hook(__FILE__, function() {
error_log("✅ Hello Plugin 已激活!");
});
add_action('admin_menu', function() {
add_menu_page(
'Hello Plugin',
'Hello Plugin',
'manage_options',
'hello-plugin',
'hello_plugin_page',
'dashicons-smiley',
6
);
});
function hello_plugin_page() {
echo '<div class="wrap"><h1>Hello Plugin Activated!</h1><p>插件运行成功 🎉</p></div>';
}
add_action('init', function() {
add_rewrite_rule('^hello-plugin/?$', 'index.php?hello_plugin=1', 'top');
});
add_filter('query_vars', function($vars) {
$vars[] = 'hello_plugin';
return $vars;
});
add_action('template_redirect', function() {
if (get_query_var('hello_plugin')) {
header('Content-Type: text/plain; charset=utf-8');
echo "Hello from WordPress Plugin! 👋";
exit;
}
});