Product Documentation System
WordPress plugin for product documentation with versioning and access control
by Ayush Meher · github.com/ayush-meher/product-documentation-system · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/ayush-meher/product-documentation-system/archive/refs/heads/main.zipRequires: WordPress 6.0+, PHP 7.4+
License: GPL v2 or later
A professional WordPress plugin for managing versioned product documentation with granular user access control and analytics.
Features
Core Functionality
Product Management
- Create multiple products, each with its own documentation library
- Each product can have unlimited versions (1.0, 1.1, 2.0, etc.)
- Versions are product-specific, preventing confusion between different products
Documentation System
- Create documentation pages assigned to specific products and versions
- Clean, SEO-friendly URLs:
/docs/product-name/version/documentation-title/ - Professional templates with breadcrumb navigation and version badges
- Automatic URL generation based on product, version, and title
User Access Control
- Assign specific users to specific products
- Administrators automatically have access to all documentation
- Non-logged-in users are redirected to login
- Users without access see a professional "Access Denied" page
- Server-side security ensures access rules cannot be bypassed
Analytics Dashboard
- Track documentation views per page and per product
- Identify most popular documentation
- Monitor which versions are being used
- View recent activity and engagement metrics
- Dashboard widget shows key statistics at a glance
Admin Tools
- Overview page shows all products, versions, users, and documentation in one place
- Quick edit and add documentation buttons
- Debug tools for troubleshooting
- One-click sample data installation for testing
How to Install, Activate and Use the Plugin
Installation
Step 1: Upload the Plugin
- Download the plugin ZIP file
- Log in to your WordPress admin panel
- Navigate to Plugins > Add New
- Click "Upload Plugin"
- Choose the ZIP file and click "Install Now"
- Click "Activate Plugin"
Step 2: Configure Permalinks
This step is required for the custom URL structure to work:
- Go to Settings > Permalinks
- Click "Save Changes" (you don't need to change any settings)
- This refreshes WordPress rewrite rules
Step 3: Install Sample Data (Optional but Recommended)
To see how the plugin works with example content:
- Go to Products > Debug Info
- Click the "Install Sample Data" button
- This creates 3 sample products with documentation
Basic Usage
Creating Your First Product
- Go to Products > Add New
- Enter a product name (e.g., "Analytics Platform")
- Add a description in the content editor
- Click "Publish"
Adding Versions to a Product
- Edit your product
- Scroll to the "Version Management" box
- Click "+ Add Version"
- Enter a version number (e.g., "1.0")
- Add more versions as needed
- Click "Update"
Assigning User Access
- Edit your product
- Scroll to the "User Access Control" box
- Check the boxes next to users who should access this product
- Click "Update"
Note: Administrators always have access to all products.
Creating Documentation
- Go to Documentation > Add New
- Enter a title (e.g., "Getting Started Guide")
- Write your documentation content
- In the right sidebar, select:
- Product: Choose your product
- Version: Choose a version (only versions from selected product will appear)
- Click "Publish"
Viewing Documentation
After publishing, you'll see the documentation URL in the sidebar. It will look like:
https://yoursite.com/docs/analytics-platform/1-0/getting-started-guide/
You can also find documentation URLs in Products > Overview.
Managing Multiple Versions
To document different versions of the same product:
- Create documentation for version 1.0
- Create separate documentation for version 2.0
- Each version can have completely different content
Users can access documentation specific to the version they're using.
Using the Overview Page
Go to Products > Overview to see:
- All products with their assigned versions
- Number of documentation pages per product
- Which users have access to each product
- View counts for products and documentation
- Quick links to edit or add documentation
Viewing Analytics
Go to Products > Analytics to see:
- Total views across all documentation
- Most viewed documentation pages
- Performance metrics per product
- Most popular versions
- Recent viewing activity
The main WordPress dashboard also shows a widget with summary statistics.
How It Works
URL Structure
The plugin creates a custom URL pattern for documentation:
https://yoursite.com/docs/{product-slug}/{version-slug}/{doc-slug}/
For example:
https://yoursite.com/docs/analytics-platform/1-0/getting-started/
https://yoursite.com/docs/analytics-platform/2-0/api-reference/
https://yoursite.com/docs/email-suite/1-5/setup-guide/
This structure is:
- Clean and readable
- SEO-friendly
- Easy to share
- Automatically generated
Data Organization
Products
- Stored as a custom post type called "product"
- Each product has its own set of versions stored as post metadata
- Versions are stored as an array (e.g., ['1.0', '1.1', '2.0'])
Documentation
- Stored as a custom post type called "documentation"
- Each documentation page stores:
- Associated product ID
- Associated version string
- View count
- Last viewed timestamp
- List of unique viewers
User Access
- Stored in WordPress user metadata
- Each user has a meta field
_pds_accessible_productscontaining an array of product IDs - Access is checked server-side when documentation is requested
Request Flow
When a user visits a documentation URL:
- WordPress matches the URL pattern and extracts the product, version, and doc slugs
- The plugin finds the product by its slug
- The plugin finds the documentation matching the product, version, and doc slug
- Access control checks if the user is allowed to view this product
- If allowed, the documentation template is loaded
- If denied, the user sees an access denied page or login screen
- Analytics tracking increments the view count
Access Control Logic
User visits documentation URL
↓
Is user an administrator?
↓ Yes → Grant access
↓ No
Is user logged in?
↓ No → Redirect to login
↓ Yes
Does user have access to this product?
↓ Yes → Show documentation
↓ No → Show "Access Denied" page
Analytics Tracking
When documentation is viewed:
- View count for the documentation page is incremented
- View count for the parent product is incremented
- Last viewed timestamp is updated
- If the viewer is logged in, their ID is added to the unique viewers list
- No personal information or IP addresses are stored
Analytics can be viewed by administrators in:
- Products > Analytics (full dashboard)
- WordPress Dashboard (summary widget)
- Products > Overview (view counts per item)
Version Management
Unlike typical WordPress plugins that use taxonomies for versions, this plugin:
- Stores versions as metadata on each product
- Allows each product to have completely independent versions
- Prevents confusion between "Version 1.0" of different products
- Provides a dedicated interface for managing versions per product
- Automatically filters version dropdowns to show only relevant versions
Security Measures
- All access checks happen server-side and cannot be bypassed
- Form submissions use WordPress nonces to prevent CSRF attacks
- User capabilities are verified before saving data
- All database queries use prepared statements to prevent SQL injection
- User input is sanitized before storage
- Output is escaped before display
- Access denied responses use proper HTTP status codes (403)
Technical Information
Custom Post Types:
product- For productsdocumentation- For documentation pages
Meta Fields:
_pds_versions(product) - Array of version strings_pds_product_id(documentation) - ID of associated product_pds_product_version(documentation) - Version string_pds_views(documentation, product) - View count_pds_last_viewed(documentation) - Last view timestamp_pds_viewers(documentation) - Array of user IDs who viewed_pds_accessible_products(user) - Array of accessible product IDs
Admin Pages:
- Products > Overview - Comprehensive view of all data
- Products > Analytics - Usage statistics and insights
- Products > Debug Info - Diagnostic tools and sample data installer
Hooks and Filters: The plugin uses standard WordPress hooks for extensibility. Custom templates can be added to your theme by creating:
single-documentation.php- For documentation pagesaccess-denied.php- For access denied pages
Support and Documentation
For questions or issues, please refer to:
- Products > Debug Info for diagnostic tools
- Sample data (install via Debug Info page) for examples
- Products > Overview to verify your setup
License
This plugin is licensed under GPL v2 or later.
Copyright (c) 2024 Ayush Meher