How to integrate ONLYOFFICE Docs with WordPress
ONLYOFFICE Docs is an open-source office suite which comprises collaborative editors for text documents, spreadsheets, presentations, and forms along with PDF viewer. The package is distributed on terms of the AGPL v3.0 license. OOXML is used as a core format.
ONLYOFFICE Docs can be integrated with various cloud services such as CMS frameworks (WordPress, Strapi, Drupal), collaboration & content platforms (ONLYOFFICE Workspace, Nextcloud, Seafile, Confluence, Alfresco), issue trackers (Jira, Redmine), e-learning solutions (Moodle, Chamilo, HumHub), and others. You are able to embed the editors into your own web service as well.
WordPress is an open-source content management system used as a publishing service for blogs and websites. You can extend WordPress using lots of available themes and plugins, including ONLYOFFICE. It allows inserting documents in posts for viewing with no need to download them, as well as collaborating on office files from the admin dashboard.
In this tutorial, we’ll learn how to connect the ONLYOFFICE Docs and WordPress instances using an integration plugin (connector).
Prerequisite: ONLYOFFICE is compatible with WordPress v.5.9.0 and higher.
Step 1: Install ONLYOFFICE Docs
To be able to work with office documents in WordPress, you need an instance of ONLYOFFICE Docs (Document Server). The installation way officially recommended by developers is to use Docker. It allows installing the latest version of the editors with all the dependencies running the single command:
sudo docker run -i -t -d -p 8080:80 --restart=always onlyoffice/documentserver
Step 2: Install integration plugin
ONLYOFFICE integration plugin for WordPress is free and distributed under the GNU GPL v2.0 license. To install it, clone the plugin master branch:
git clone https://github.com/ONLYOFFICE/onlyoffice-wordpress
Navigate to the Plugins section in the WordPress administrative dashboard and activate the ONLYOFFICE plugin.
The integration plugin is also available in the official WordPress Plugins Directory.
Step 3: Configure instance
Go to the WordPress administrative dashboard, switch to ONLYOFFICE Settings and specify the following parameters:
- Document Editing Service address. It is the URL of the installed ONLYOFFICE Document Server.
- Document server JWT secret key. It enables JWT to protect your documents from unauthorized access. You need to specify the same secret key in the ONLYOFFICE Document Server config file to enable the validation.
Step 4: Use ONLYOFFICE Docs in WordPress
All uploaded files from the Media section appear on the ONLYOFFICE Files page within the admin dashboard.
Users with the administrator rights are able to edit and collaborate on docx, xlsx, and pptx files using real-time and paragraph-locking co-editing modes, Track Changes, comments, and built-in chat.
The corresponding ONLYOFFICE editor opens in the same tab when you click on the file name. All the changes are saved in the same file after each editing session when all co-authors leave the document.
You can also add the ONLYOFFICE block when creating a post and upload a new file or select one from the Media Library.
The added file is displayed as the ONLYOFFICE logo with the file name in the currently edited post. After the post is published, WordPress site visitors have access to this file for viewing in the embedded mode. This way, they can view the inserted file without downloading it.
The following file formats are supported for inserting and viewing: doc, docx, docm, dot, dotx, dotm, odt, fodt, ott, rtf, txt, html, htm, mht, xml, pdf, djvu, fb2, epub, xps, xls, xlsx, xlsm, xlt, xltx, xltm, ods, fods, ots, csv, pps, ppsx, ppsm, ppt, pptx, pptm, pot, potx, potm, odp, fodp, otp.
That’s all! Now you can work with office files within WordPress using ONLYOFFICE Docs.