=== Kotia – AI Content Importer ===
Contributors: infoxe
Tags: ai content, content import, article importer, post import, seo metadata
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 2.6.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Import AI content prepared in Kotia.app into WordPress as review-ready drafts, including images, taxonomies, authors, and SEO metadata.

== Description ==

Kotia.app is an AI content workspace for researching, writing, editing, and preparing complete articles with SEO data.

Kotia – AI Content Importer securely imports articles prepared in Kotia.app into WordPress as review-ready drafts, including images, categories, tags, author ownership, featured images, and SEO metadata.

Content is created and edited in Kotia.app. The plugin does not generate AI content inside WordPress and never publishes articles automatically.

**Kotia – AI Content Importer works exclusively with [Kotia.app](https://kotia.app/) and requires a Kotia.app account.**

The plugin creates an authenticated connection between Kotia.app and your WordPress website using a Bearer token.

**Features**

* Send WordPress drafts from Kotia.app
* Upload JPEG, PNG, WebP, and GIF images
* Create and assign categories and tags
* Set featured images
* Transfer titles, content, excerpts, slugs, and publication dates
* Transfer SEO titles, descriptions, and focus keywords
* Integrate with Yoast SEO when it is installed
* Verify the token and plugin endpoint through a status endpoint
* Protect import requests with token-based authentication
* Assign imported posts and media to a selected WordPress author

**SEO Support**

When Yoast SEO is installed, SEO fields are automatically mapped to the corresponding Yoast metadata.

When Rank Math, All in One SEO, or SEOPress is active, the plugin stores the transferred SEO data in its own custom fields and leaves frontend metadata output to the active SEO plugin to avoid duplicate tags. Automatic field mapping is currently available for Yoast SEO only.

When no supported external SEO plugin is active, the plugin:

* Stores SEO fields as WordPress custom fields
* Makes the fields available in the WordPress editor
* Renders the SEO description and keywords in the HTML document head
* Uses the supplied SEO title as the document title

**REST API**

The REST API is intended for communication between Kotia.app and WordPress. It normally does not need to be called manually.

POST endpoints:

* `/wp-json/kotia-content-integration/v1/post`
* `/wp-json/kotia-content-integration/v1/media`
* `/wp-json/kotia-content-integration/v1/category`
* `/wp-json/kotia-content-integration/v1/tag`
* `/wp-json/kotia-content-integration/v1/set-thumbnail`

GET endpoint:

* `/wp-json/kotia-content-integration/v1/status`

All requests must use Bearer token authentication:

`Authorization: Bearer TOKEN`

Supported SEO fields during post creation:

`meta_title` — SEO title

`meta_description` — SEO description

`focus_keyword` — focus keyword

**External Service**

This plugin does not generate AI content inside WordPress and is not intended to work as a standalone plugin.

Content is created and edited in Kotia.app and then transmitted to the connected WordPress website through authenticated REST API requests.

Imported articles are always created as WordPress drafts so they can be reviewed before publication.

A Kotia.app account is required:

* [Kotia.app website](https://kotia.app/)
* [Terms of Service](https://kotia.app/rules)
* [Privacy Policy](https://kotia.app/policy)

== Installation ==

1. Upload plugin folder to /wp-content/plugins/
2. Activate plugin
3. Select the default WordPress author in Settings → Kotia – AI Content Importer
4. Generate an API token
5. Connect the WordPress site to Kotia.app using the generated token
6. Send content from Kotia.app for review as a WordPress draft

Use HTTPS on production websites to protect the token and transmitted content in transit.

== Changelog ==

= 2.6.1 =
* Fixed: a fatal "allowed memory size exhausted" error on requests from Kotia when Yoast SEO (or any plugin that asks for the current user inside a capability check) is active
* The default author is no longer capability-checked while WordPress determines the current user, matching how core authenticates Application Passwords; the author is validated as before when the request reaches the route
* Added a re-entry guard so token authentication can never recurse into user determination

= 2.6.0 =
* Fixed: imports now work on sites where a security plugin (Clearfy and similar) redirects or blocks the WordPress REST API for anonymous requests
* The Kotia token is now verified while WordPress determines the current user, the same stage core uses for Application Passwords, instead of only at route permission check
* Token checking is limited to the plugin's own REST namespace; behaviour on sites without such security plugins is unchanged

= 2.5.0 =
* Renamed the display name to Kotia – AI Content Importer and clarified the WordPress.org listing
* Added a required default WordPress author for imported posts and media
* Ensured all imported articles are created as drafts
* Redesigned the settings page with setup status and Kotia.app links
* Improved token regeneration and REST authentication handling
* Added conflict-safe handling for Rank Math, All in One SEO, and SEOPress
* Namespaced Kotia SEO custom fields while preserving reads from legacy fields

= 2.4.1 =
* Fixed tag assignment bug causing numeric tag names when importing posts

= 2.4.0 =
* Added SEO support
* Added status endpoint
* Improved REST API security
* Yoast SEO compatibility
* Custom fields fallback

= 2.3.0 =
* Initial REST API support
* Media upload
* Post import

== Frequently Asked Questions ==

= How to get API token? =
Go to Settings → Kotia – AI Content Importer and generate new token.

= Does it work without Yoast SEO? =
Yes. When no supported external SEO plugin is active, SEO fields are stored as custom fields and rendered in the HTML document head. With Rank Math, All in One SEO, or SEOPress active, Kotia stores the transferred fields but lets that plugin control frontend metadata. Automatic field mapping is currently available for Yoast SEO only.

= How to check connection? =
Use the GET /status endpoint to verify the token and plugin route. Then send a test draft after selecting the default WordPress author.

= Which WordPress user owns imported content? =
Select the default author in Settings → Kotia – AI Content Importer. The selected user owns imported posts and media.

== License ==

GPLv2 or later
