您需要做的是设置自定义重写。这可能会改变http://site.com/rotate/1
到http://site.com/wp-content/plugins/ad-rotating-plugin/rotate.php?trackerid=1
这里有一些untested 可能有帮助的代码:
<?php
/*
Plugin Name: Your Plugin
Plugin URI:
Description:
Version: 0.1
Author:
Author URI:
*/
// Add rewrite rule and flush on plugin activation
register_activation_hook( __FILE__, \'ad_rotate_activate\' );
function ad_rotate_activate() {
ad_rotate_rewrite();
flush_rewrite_rules();
}
// Flush on plugin deactivation
register_deactivation_hook( __FILE__, \'ad_rotate_deactivate\' );
function ad_rotate_deactivate() {
flush_rewrite_rules();
}
// Create new rewrite rule
add_action( \'init\', \'ad_rotate_rewrite\' );
function ad_rotate_rewrite() {
add_rewrite_rule( \'rotate/([^/]+)\',\'/wp-content/plugins/ad-rotating-plugin/rotate.php?trackerid=$matches[1]\',\'top\' );
}