=== SEOLOK ===
Contributors: seolok
Tags: seo, search console, core web vitals
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.6.10
License: GPLv2 or later

Applies SEO fixes you approve in SEOLOK, shows your site's SEO jobs as a to-do list in WordPress and, only if you switch it on, keeps SEOLOK up to date.

== Description ==

* Applies actions approved in SEOLOK: SEO title + meta description, noindex, 301 redirect (merge).
  Works with Yoast SEO, Rank Math or plain WordPress. Values live in the plugin's own post meta/options;
  removing them (or deactivating the plugin) reverts the change.
* Only if an administrator ticks "Show SEOLOK to visitors" in Settings → SEOLOK (off by default): during an active SEOLOK Boost
  campaign, a small opt-in button for browser notifications (permission is only requested after a click; the subscription is stored
  in SEOLOK), and, if the site joined the SEOLOK network in SEOLOK, a "recommended" box with links to other member sites under posts
  (marked as recommendations, rel="nofollow sponsored").
* Fixes broken links you approve in SEOLOK, one link on one page at a time: re-points the link to a new address or removes it
  (the link text stays). The previous content of the page is saved first, so SEOLOK can undo the change while the page is still as
  the plugin left it. Pages built with Elementor or Beaver Builder are left alone.
* Gives a page the address you approve in SEOLOK (only its last path segment, for example a yearly page from /guide-2025/ to /guide-2026/), sends the old address to the new one with a 301 and can undo it while the address is still the one SEOLOK set.
* SEOLOK → SEO titles: the SEO title and meta description SEOLOK suggests for pages that show up on Google but get few clicks, with a search result preview (desktop and mobile) and simple length/search-term checks. Approve or reject (the decision is recorded in SEOLOK too), apply it on the page and undo it later.
* SEOLOK → Alerts: checks run inside WordPress for what keeps a site out of Google: the "Discourage search engines" setting, robots.txt (the file or the one WordPress writes) and a "noindex" tag on the home page and a few key pages (opened like a visitor, when you ask), with a one-click "Allow search engines", a timeline of what changed and per-warning "ignore" that can be undone.
* SEOLOK → Live sync: the switch, what waits to be sent, what was sent, which content types are told and a log of switches and errors.
* Shows SEOLOK's jobs for your site as one to-do list under SEOLOK → Overview, most important first: broken links (fix them on every page that uses a dead address, with undo), technical checks, today's jobs, site health; what needs nothing as one line of ticks, and live sync, search engines and the latest changes in a small status table. A small number next to the menu item shows what waits for you.
* Live sync (off by default, switched on and off by an administrator on the Lokman page): the plugin tells SEOLOK about pages you publish, update or delete, about search engines being switched on or off, and about the state of the site (versions, counts). SEOLOK then reads a changed page soon after, warns you at once when search engines get blocked (a forgotten staging setting is the classic way to disappear from Google) and can offer a one-click "Allow search" button.
* Every request from SEOLOK is signed with your site token (HMAC-SHA256, 5-minute window).

The plugin needs a SEOLOK account (free to start). Everything the plugin does in WordPress works with any SEOLOK plan, including applying and undoing SEO titles and descriptions from the SEO titles screen. SEOLOK's own service features (for example applying changes automatically from the SEOLOK panel) depend on your SEOLOK plan.

== External services ==

This plugin is the WordPress side of the SEOLOK service (https://seolok.com, or the address you set under Settings → SEOLOK). It does nothing until you paste your site ID and token from a SEOLOK account into Settings → SEOLOK, and every request it makes is signed with that token. The service is provided by SEOLOK: terms of use https://seolok.com/en/legal/terms, privacy policy https://seolok.com/en/legal/privacy.

What is sent, when and why:

* SEOLOK → WordPress (applying fixes): SEOLOK calls the plugin's REST endpoints `/wp-json/seolok/v1/ping` and `/wp-json/seolok/v1/apply` only after you approve a change in SEOLOK (or click "Test connection"). The plugin answers with the result and its own, WordPress' and the active SEO plugin's version.
* SEO titles: when an administrator opens SEOLOK → SEO titles, the plugin fetches this site's title and description suggestions (site ID and the admin screen's language are sent). A button sends its action and the suggestion's ID; "Apply" and "Undo" are written on the page by the plugin itself, which then sends SEOLOK the title and description it replaced (so they can be put back later).
* Alerts: the checks run inside WordPress and send nothing; "Check the pages" opens your own pages from your server, like a visitor would.
* Lokman page: when an administrator opens SEOLOK → Overview or clicks one of its buttons, the plugin fetches the page's content from SEOLOK and sends the button you clicked (for example "remove this link on all pages", with the addresses concerned). Sent: site ID, plugin version, whether live sync is on, the language of the admin screen and the action.
* SEOLOK → Old posts: the list of posts not updated for 18 months is built inside WordPress. When an administrator clicks "Is it still current? Check" for one post, the plugin sends that post's address and its last update date (signed); SEOLOK reads the public page itself and writes what to check. Opening the screen reads the results of those checks and how many checks are left today (cached two minutes). "Current, mark it" and "Ignore" stay in WordPress.
* "SEOLOK: site status" box on the WordPress Dashboard (administrators only): when the Dashboard opens it reads the number of SEO title suggestions per state from SEOLOK (the same signed request as the SEO titles screen, cached for two minutes); everything else in the box is what the plugin already keeps on your site.
* Live sync, off until an administrator switches it on (SEOLOK → Live sync, or the Live sync row on SEOLOK → Overview); the content types it tells about can be chosen there. While it is on the plugin sends about once an hour and when something happens a report with the WordPress and PHP version, the plugin's version, the site address and language, whether it is a multisite, whether the address is https, whether pretty permalinks are on, whether "Discourage search engines" is on, the name of the SEO and cache plugin in use, the number of published posts/pages/drafts, whether a WordPress core update and how many plugin/theme updates are waiting, whether WP-Cron is disabled and how late it is, the 30 most-asked addresses of your site that answered "not found" (404: the path, how often and the first and last day; see "404 addresses" below); and events: the address, title and post type of a page you publish, update, take offline or delete (visitor-written content such as forum topics and replies is left out), a changed page address, search engines switched on or off, a changed permalink structure, and the names of plugins and themes you switch on or off. It never sends page content, visitors, users, comments or passwords. "Turn off" on the same row stops everything at once, removes the schedule and deletes what was waiting to be sent; it (and deactivating the plugin) sends one last message saying sync is off, with the site address.
* 404 addresses (SEOLOK → 404 addresses): when WordPress answers a visitor's request with "not found", the plugin adds one to that address's count, in your own database. Kept: the path without its query string, the number of hits, the first and last day and where visitors came from (a page of your own site by its path, another site by its domain only, e.g. google.com; nothing else of that address). Never an IP address, browser, search words or anything about the visitor; where visitors came from is not sent to SEOLOK. Logged-in staff, WordPress and scanner addresses (wp-admin, wp-login, .php, dot files) and files (scripts, styles, images, fonts) are not counted; at most 500 addresses are kept. The list leaves WordPress only inside the live sync report (above), while live sync is on. "301 redirect", "Ignore" and "Undo" on that screen stay in WordPress.
* Features visitors see, off until an administrator ticks "Show SEOLOK to visitors" in Settings → SEOLOK. Then the site asks SEOLOK at most once an hour (site ID only) whether a Boost campaign runs and whether the site is in the SEOLOK network. During a campaign, a visitor who clicks the notification button and allows notifications in the browser sends their browser's push subscription (an endpoint address and keys, no name or e-mail) with the site ID to SEOLOK. With the network on, a visitor's browser asks SEOLOK for recommendations, sending the site ID and the address of the post being read; no cookies are sent.
* Link indexing: if you use it in SEOLOK, the plugin stores your site's public key and serves it as /<key>.txt so search engines (IndexNow) can verify SEOLOK's notifications; the plugin itself sends nothing for this.

== Installation ==

1. Download the zip from SEOLOK → your site → Overview → WordPress plugin, then Plugins → Add New → Upload.
2. Settings → SEOLOK: paste the Site ID and token shown in SEOLOK.
3. In SEOLOK click "Test connection".

== Frequently Asked Questions ==

= Do I need a SEOLOK account? =

Yes. The plugin is the WordPress side of SEOLOK: the jobs, the broken-link list and the fixes come from your site's analysis in SEOLOK. You paste the site ID and token from SEOLOK into Settings → SEOLOK.

= Is it free? =

Yes. The plugin is free and nothing in it is locked: every screen and button works with a free SEOLOK account, including applying SEO titles and descriptions on your pages. Paid SEOLOK plans add service features on seolok.com (for example automatic changes started from the SEOLOK panel and more reports); see https://seolok.com.

= Does it send anything without my permission? =

No. Nothing is sent until you connect the plugin with your site ID and token. Live sync and the features visitors see are off until an administrator switches them on, and both can be switched off again at any time (see "External services").

= Does it change my theme or my pages' look? =

No. Everything the plugin adds uses its own "seolok-" class names and no global CSS. SEO titles, descriptions, noindex and 301s are served through WordPress filters; deactivating the plugin stops them, deleting it removes them.

= Does it work with Yoast SEO or Rank Math? =

Yes. SEO titles and meta descriptions approved in SEOLOK are written in a way that works with Yoast SEO, Rank Math or plain WordPress.

= Can I undo a change? =

Yes. Fixed links, 301 redirects and page address changes can be undone from SEOLOK or from the Lokman page while the page is still as the plugin left it; the plugin keeps the previous content of the last three changes of a page.

== Screenshots ==

1. SEOLOK → Overview: this site's to-do list (broken links, technical checks, today's jobs), the ticks for what is fine and the status table (live sync, search engines).
2. Broken links: one approval fixes a dead address on every page that links to it, and each change can be undone.
3. SEOLOK → Live sync: off by default; the switch, what waits to be sent, what was sent and an audit log.
4. SEOLOK → Alerts: search engines blocked, with the one-click "Allow search engines", the checks, a timeline and the affected pages.
5. Settings: the site ID and token from SEOLOK, and "Show SEOLOK to visitors" (off by default).
6. SEOLOK → SEO titles: a suggested title and description applied on the page, with a search result preview, checks and undo.

== Changelog ==

= 0.6.10 =
* SEO titles: the search term SEOLOK writes a title for is now used word for word in both the new title and the new description, near the start of the title, the way Rank Math and Yoast check the focus keyword. The checks under a suggestion now also say whether the term is at the start of the title and whether it is in the description.
* Backlinks: on plans without backlink tracking the screen says so instead of showing an empty list.

= 0.6.9 =
* SEO titles can be applied on category, tag and other archive pages too (the address of a category whose base is dropped, such as /idare-hukuku/, used to answer "not a page of this site"); they are written into Rank Math's / Yoast's term fields and undone the same way. Pages of other post types are found by their path as well.
* "The title was changed after this suggestion was written" no longer fires on a title that only differs by the site name, a %variable% of the SEO plugin's template or an HTML entity; when it does fire, SEOLOK is told, counts the text as "to write" and writes it again from the current title.
* Bulk runs: the progress says how many were done and how many could not be; the summary lists every page that failed with its reason.
* The status "Approved" reads "Approved · on the to-do list", the same words as SEOLOK; the SEO titles list refreshes within half a minute after a decision in SEOLOK, the Overview and the broken-link list within a minute, the insight screens within two.

= 0.6.8 =
* Updates from SEOLOK: WordPress now shows its own "new version available" notice for SEOLOK on the Plugins and Updates screens, updates it with one click, and the "Enable auto-updates" switch works for it. The update is taken only from the SEOLOK address the plugin is set up with.
* SEOLOK → Overview redesigned: four headline numbers (broken links, site health score, today's jobs, technical issues), the to-do list next to a site summary (health score, pages scanned and, with Search Console connected, visits from Google and average position over the last 28 days against the 28 before), recent activity, shortcuts and content opportunities. Every number comes from SEOLOK; a number SEOLOK does not have is shown as "—" with what is needed. All the fix, 301 and undo buttons of the to-do list work as before.
* SEOLOK → Alerts redesigned: a site health card with the last check and "Check again", four summary cards, important alerts, detail cards for robots.txt, meta robots and site visibility, affected pages, the alert timeline and five other technical checks (HTTPS, permalinks, WP-Cron, XML sitemap and canonical tags, the last two new).
* Alerts: the key pages are checked automatically once a day (WP-Cron), so the timeline moves without a click.
* New screens under SEOLOK with SEOLOK's own data (read-only, nothing on the site changes): Site analysis (score, every issue with why, how to fix and its pages), Content opportunities, Keywords (Google rank, change, monthly searches, Search Console position), Competitors, Backlinks (domain score, linking sites, latest links) and Reports. Each has "Open in SEOLOK" for the full page.
* WordPress Dashboard: a full-width SEOLOK panel on top for administrators (site status, broken links / alerts / old posts waiting, SEO titles by state, live sync counters and the last things sent, today's jobs worked out from those facts, technical health, shortcuts, content opportunities). A fact SEOLOK has not sent is shown as unknown, never as "none". "Hide this panel" brings the small SEOLOK box back.
* 404 addresses redrawn like the other screens: numbers on top (not found, seen this week, linked from your own pages, redirected), and for each address where its visitors came from (your own page with an Edit link, another site's domain, or typed), the pages SEOLOK's scan saw linking to it, SEOLOK's suggestion and the 301.
* Overview: Lokman's "N jobs today" sentence has a button to them, and today's jobs show open.
* Overview: the biggest issues of SEOLOK's last scan in the to-do list (each opens Site analysis), linking sites in the site summary, and "Ask a question" (SEOLOK's support page for the site).

= 0.6.7 =
* New screen SEOLOK → 404 addresses: the addresses visitors asked for that answered "not found", counted per path (no IP address, browser or referrer is kept; staff, scanner addresses and files are not counted; at most 500 addresses). Each one can be sent to another page of the site with a 301 (the same redirect the broken-link fixes use, with undo) or ignored. While live sync is on, the 30 most-asked addresses go to SEOLOK with the hourly report; SEOLOK suggests a similar page for the 301 and can apply it from Overview.

= 0.6.6 =
* Live sync screen: when WordPress's scheduled tasks (WP-Cron) are late or switched off, the notice now comes with a "Run scheduled tasks now" button for administrators. It runs WordPress's own scheduler (wp-cron.php) once, the way a server cron does, so it works even when WP-Cron is switched off in wp-config.php; the answer says whether it ran, is still running (a long task such as a backup), or could not be reached (then SEOLOK's waiting changes are sent from the screen instead). A real server cron stays the lasting fix: the screen explains it for any host (cPanel, DirectAdmin, Plesk, Windows/IIS, or a free outside service that opens the address every 5 minutes).

= 0.6.5 =
* SEO titles: a bulk button no longer does everything in one go. The selected suggestions are queued and handled one at a time, with a progress bar and a Stop button on the screen; if you close the page, WordPress's scheduled jobs (WP-Cron) carry on, still one at a time. Each suggestion goes through the same steps as its own button, so SEOLOK sees every decision as it happens. Up to 200 suggestions can be queued.

= 0.6.4 =
* Live sync: after a failed report the next tries wait longer each time (1, 2, 4 … minutes, at most an hour); a report that gets through resets the wait.
* Live sync: when WP-Cron is late or off, waiting changes are sent from an administrator's own visit to the admin (at most every two minutes) instead of waiting for the next hour; the screen says so instead of promising "within a minute".
* Live sync screen: the age of the oldest waiting change, the next try, and errors in plain words (no raw codes).
* Live sync: the content-type list offers only what is ever sent (no templates, forms or form entries); the report tells SEOLOK how many changes wait and why the last one failed.

= 0.6.3 =
* SEOLOK → Overview is drawn the way WordPress draws its own screens: instead of six equal cards with coloured stripes and a big number each, one to-do list (most important first, e.g. "50 broken links waiting to be fixed — Fix", "2 technical issues — See"), every number inside its sentence with its scale ("Site health: 88/100 · Last scan: 10 Oct"), what needs nothing as one line of ticks, and live sync, search engines and the latest changes in a small status table at the bottom. Every button does what it did before.
* Works with an older SEOLOK too: the same layout is worked out from the cards it sends.

= 0.6.2 =
* Settings → SEOLOK no longer prints the saved token back (not even in the page source); leave the field empty to keep it, paste a new one to replace it.
* The overview shows only the end of the connected SEOLOK site ID.

= 0.6.1 =
* SEO titles: after "Apply on site" or "Reject" the screen opens the next suggestion that still waits (approve or apply), going round the list.
* SEO titles: select suggestions (or all of them) and approve, approve and apply, or reject them at once; one title per page, at most 20 per click.
* An applied title and description are also written into Rank Math's or Yoast's own fields, so their editor and score show them; an empty focus keyword gets the search term and an empty excerpt the description. Undo puts every field back exactly.
* A "SEOLOK: site status" box on the Dashboard: broken links and alerts waiting, SEO titles by state, live sync and the last things sent.
* SEOLOK → Old posts: posts and pages not updated for 18 months, with old years in their title or text; "Is it still current? Check" asks SEOLOK what to check and update (up to 20 a day), or mark a post current / ignore it.
* Broken links: the new-address box suggests the site's published pages as you type.

= 0.6.0 =
* New SEOLOK menu: Overview, SEO titles, Alerts, Live sync, Settings. SEO titles: review, approve, apply and undo SEOLOK's title and description suggestions (applying works on every SEOLOK plan). Alerts: the reading setting, robots.txt and noindex checked inside WordPress, with a timeline. Live sync: queue, counters, content types and an audit log.
* The Lokman page is now a set of cards: a headline number and one sentence per topic (broken links, today's jobs, site health, technical checks, search engines, live sync, latest changes), the details folded behind one button, and one line of ticks for everything that needs nothing. A small number in the admin menu shows what waits for you.
* New, off by default: live sync (see "External services"). An administrator switches it on or off with one click on the Lokman page. While it is on, SEOLOK is told about published/updated/deleted pages and about search engines being switched on or off, and gets an hourly report of the site's state, so SEOLOK can look at a new page soon after it goes live (on smaller sites; and tell search engines if you turned that on in SEOLOK) and a blocked-search-engines mistake is flagged at once.
* New button "Allow search" on the red card that appears when "Discourage search engines" is ticked: it clears that one setting (and nothing else).
* The plugin now removes its schedule when it is deactivated (and tells SEOLOK that live sync is off).
* New setting "Show SEOLOK to visitors" (off by default): the Boost notification button and the SEOLOK network box only appear, and the site only asks SEOLOK about them, after an administrator ticks it.
* Deleting the plugin now removes everything it stored (settings, SEO values, 301s, page backups, the live-sync outbox).

= 0.5.3 =
* Page address change: after the address of a page changed (or the change was undone) the plugin asks LiteSpeed Cache, WP Rocket, W3 Total Cache and WP Super Cache to forget the old and the new address, so a cached "not found" or a cached redirect of the previous state is not served for an hour or longer.

= 0.5.2 =
* Easier to find: "Settings" and "Lokman" links in the plugin list, an "Open Lokman" button on the Settings → SEOLOK page, and the connected SEOLOK site ID under the Lokman page (SEOLOK opens a site only in the account that owns it, so a link that says "not found" there usually means this WordPress is connected to a site of another account).

= 0.5.1 =
* Page address change: when a dead link differs from a live page only by the year and the page itself already shows the new year, SEOLOK can give that page the new address (same folder, letters, digits and hyphens only) and 301 the old address to it. Nothing is written until you approve it in SEOLOK; the undo works while the address is still the one SEOLOK set. A page that has child pages (and the front page) is never renamed, and an address that another page, a reserved word or a number-only slug stands in the way of is refused before anything is saved.
* Redirects: a 301 that would lead back to its own source (a loop) is refused, and 301s are now also served when WordPress is installed in a sub-folder.
* The plugin tells SEOLOK its version number with each request, so the Lokman page only offers buttons your plugin can handle.

= 0.5.0 =
* New "SEOLOK → Lokman" page in the WordPress admin: today's jobs, your site's health, broken-link cleanup (with undo) and your latest changes. Only administrators see it.
* Broken-link cleanup: SEOLOK can re-point or remove a link inside a page's content and undo it later (the last 3 changes per page are kept), on one page or on every page that links to the same dead address. SEOLOK can also undo a 301 it added. Nothing is written until you approve it in SEOLOK.
* Everything the plugin adds to your pages uses "seolok-" class names and no global CSS, so it cannot change how your theme looks.

= 0.4.0 =
* Link indexing: SEOLOK can store your site's public key and the plugin serves it as /<key>.txt, so SEOLOK can notify search engines (Bing, Yandex and others) about new or changed pages. No setting needed.

= 0.3.0 =
* "Undo" from SEOLOK: restores the previous SEO title and meta description of a page (an empty previous value removes SEOLOK's own value, so the page's original shows again).
