WP Manifestindependent plugin directory
manifest / utilities / lino-shortlinks-wordpress-plugin

LINO: Links IN / Links Out

Simple Bitly-style short links with /go/slug routing, UI/backend modes, stats, and a Gutenberg block.

by Enrico Murru · github.com/enreeco/lino-shortlinks-wordpress-plugin

0stars
0forks

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/enreeco/lino-shortlinks-wordpress-plugin/archive/refs/heads/master.zip

A lightweight WordPress plugin that provides Bitly-style short links using a custom endpoint /go/{slug}. Includes backend redirects, UI countdown redirects, daily statistics, admin management, and a Gutenberg block.


📦 Features

  • Custom route: /go/<slug>

  • Backend redirect mode (HTTP 302)

  • UI redirect mode (countdown page rendered with the active theme)

  • Custom database tables:

    • wp_sl_links for link definitions
    • wp_sl_stats for daily click tracking
  • Admin UI with tabbed interface (Links and Settings)

  • Create, edit, enable/disable, and delete links

  • Export/Import links via CSV

  • Slug customization with optional auto-generation

  • Simple statistics (clicks per day)

  • Global countdown configuration for UI redirects

  • Custom UI page support with shortcode

  • Gutenberg block with link picker

  • Clean and self-contained plugin, no external services


🛠 Installation

  1. Download the plugin ZIP (or create it using the build script - see below).
  2. Go to WordPress Admin → Plugins → Add New → Upload Plugin.
  3. Upload wp-short-links.zip and activate it.

Creating the ZIP file with the build script

To create the plugin ZIP file from the source code:

  1. Navigate to the build_script directory.
  2. Install dependencies: npm install
  3. Run the build script: npm run build
  4. The ZIP file will be created in build_script/release/ directory.

🔧 Setup & Configuration

1. Flush permalinks (required once)

The plugin registers the /go/{slug} rewrite rule. WordPress must flush rewrite rules for it to activate.

Go to: Settings → Permalinks → Save Changes (no changes required, just save)


📁 Admin Interface

After activation, a new menu appears:

LINO → Links

Links Tab

The Links tab features a two-column layout:

  • Left Column: Add/Edit Link form
  • Right Column: All Links table with Export/Import functionality

Settings Tab

Configure global plugin settings:

  • UI countdown seconds
  • Custom UI page selection

Link fields:

Field Description
Title Optional, used in UI redirect page
Full URL Required target link
Slug Optional; if blank, auto-generates a random 6-character slug (a-z, A-Z, 0-9, _)
Description Optional, shown on UI redirect page
Mode backend (immediate redirect) or ui (countdown page)
Active Toggle link availability

🔄 Redirect Modes

Backend Mode

  • Pure HTTP redirect (302)
  • No UI shown
  • Fastest option
  • Best for campaigns, API use, etc.

UI Mode

UI mode offers two options:

Default Template (Black & White)

  • Minimal, standalone page with black background and white text
  • Centered layout, fully responsive
  • Shows:
    • Title
    • Description
    • Countdown timer (default: 10 seconds)
    • "Skip and go now" button
  • Redirects automatically when the timer reaches zero
  • Works independently of your theme

Custom Page (Fully Customizable)

You can configure a custom WordPress page for UI mode redirects:

  1. Create a page in WordPress (e.g., "Redirect Page")
  2. Add the shortcode [wp_sl_redirect] in the page content
  3. Configure in Settings: Go to LINO → Settings and select your custom page
  4. Customize freely: Add your own content, images, branding, and styling around the shortcode

Shortcode: [wp_sl_redirect]

The shortcode automatically:

  • Loads the correct link data
  • Displays title, description, and countdown
  • Handles the redirect functionality
  • Updates statistics

Example page content:

Welcome! You're being redirected to our special offer.

[wp_sl_redirect]

Thank you for your patience.

You can use page builders (Gutenberg, Elementor, etc.) to fully customize the design while maintaining all plugin functionality.

Countdown duration is configurable in Settings.


📊 Statistics (Daily Aggregation)

Stats are stored in wp_sl_stats as per-day aggregated clicks.

Recorded data:

  • link_id
  • stat_date
  • clicks

Displayed directly in the admin link table:

  • Total clicks across all days
  • Last click date

Stats are incremented automatically on each visit.


🔲 Gutenberg Block

The plugin registers a block: LINO Link (wp-sl/short-link)

Features:

  • Lists all active short links
  • Allows selecting a link directly from the editor
  • Optional custom display label
  • Server-side rendering (front-end HTML generated by PHP)

This allows editors to insert short links into posts without copy/paste.


📥 Export / Import

Export Links

  • Click Export CSV in the All Links section
  • Downloads a well-formatted CSV file with all link data
  • Includes: slug, target_url, title, description, mode, is_active, created_at, updated_at
  • UTF-8 encoded with BOM for Excel compatibility

Import Links

  • Click Import CSV to show the import form
  • Upload a CSV file matching the export format
  • Import modes:
    • Skip duplicates: Keep existing links, only import new ones
    • Update duplicates: Overwrite existing links with same slug
  • Header row is optional
  • Shows results: imported, updated, and skipped counts

CSV Format:

slug, target_url, title, description, mode, is_active, created_at, updated_at
example, https://example.com, Example Link, Description text, backend, 1, 2024-01-01 00:00:00, 2024-01-01 00:00:00

🔌 LINO Link URL Format

All links follow the form:

https://your-domain.com/go/<slug>

Examples:

https://example.com/go/aZ3fK2
https://example.com/go/whitepaper_2024
https://example.com/go/utm_campaignX

Slugs are limited to:

[a-zA-Z0-9_]

and up to 50 characters.


📜 Custom Database Tables

wp_sl_links

Column Type Description
id bigint Primary key
slug varchar(50) Unique code
target_url text Redirect destination
title varchar(255) Optional title
description text Optional description
mode varchar(10) backend or ui
is_active tinyint(1) Active flag
created_at datetime Creation timestamp
updated_at datetime Update timestamp
created_by bigint WP user ID

wp_sl_stats

Column Type Description
id bigint Primary key
link_id bigint Foreign key to wp_sl_links
stat_date date Day of click
clicks bigint Number of clicks for the day

🧪 Testing Checklist

  • Verify /go/{slug} loads correctly
  • Test backend (302) redirects
  • Test UI countdown redirects (default template)
  • Test custom UI page with shortcode
  • Check that stats update
  • Test Export/Import CSV functionality
  • Insert a "LINO Link" Gutenberg block into a post
  • Disable a link and confirm it yields WP's 404 page

♻ Uninstall

The plugin does not delete its tables automatically. If you want to manually remove data, delete:

wp_sl_links
wp_sl_stats