FTP管理のデブログをWordPress管理にしました♪
なぜFTPで管理していたのか
私はほとんどの記事を多くの人々に読んでもらえるようにルビを付けているのですが、ルビを付けるためのコードである<ruby>タグを多用すると、WAF(Web Application Firewall)というセキュリティーのためのシステムが危ないコードと誤検知して、記事を保存できないことが度々ありました。WAFを回避する手段として、サーバーにあるFTP(File Transfer Protocol)というファイル置き場にデブログの記事を置き、WordPress側はFTPにあるファイルを読み込む形式で管理していました。
なぜFTP管理をやめたのか
FTPにファイルを置くと、ページの視聴回数を記録するためのGoogleタグをページごとに付けないといけません。タグの取得方法はGoogleアナリティクスのページから行うのですが、手順がやや複雑で、毎回記事を書くたびにタグを取得するのは大変と感じました。WordPressの場合は訪問者数を一括で管理しているため、管理が楽になります。
また、関連項目やサイト共通のヘッダーやフッターを使えるようになりますので、サイト内の他のコンテンツへの回遊がしやすくなるメリットもあったため、WordPress管理にしました。
大変だったこと
WordPressで管理する場合、どうやってWAFを回避するかが課題でした。最初は各項目をメタボックス(編集画面の入力欄)に保存する方法にしましたが、それはうまくいきませんでした。その後に本文入力欄に必要な項目を保存する方法も試しましたが、それもうまくいきませんでした。最終的に、メタボックスで保存できたらそのままメタボックスを使い、メタボックスで保存できなかったらFTP上にあるファイルを読み込むという折衷案になりました。
「AプランがダメならBプラン」という発想です。ここまでたどり着くのに何度もクロードにコードを修正してもらい、何回もコードを書き変えました。
WordPress版のアップデートポイント
通常、関連リンクはカスタムHTMLボックスに必要なコードを書きこんでリンクを作るのですが、今回はそれを自動化する仕組みを作りました。記事を編集する画面に「関連項目」という欄を作り、そこにURLを入力すると、サムネイルまたはSNS画像を取得して表示するシステムを作りました。
最初は文字だけのリンクでしたが、サムネイルの方がワクワク感が高まると思い、サムネイルリンクにしました。このサムネイルには少しぷるっと震える演出を加えました。パソコンではホバーアクションという、マウスをかざすとリンク画像などが大きくなったりするアニメーション機能があるのですが、スマホではホバーアクションが使えないので、パソコンでもスマホでもデバイスに関係なく楽しめる共通の演出を加えることにしました。
The Devlog Has Moved from FTP to WordPress!
Why I Originally Used FTP
I add furigana (reading guides) to most of my articles so that more people can enjoy reading them. However, when I used many <ruby> tags, the security system called WAF (Web Application Firewall) sometimes mistakenly detected the code as dangerous and prevented me from saving my articles. To work around this problem, I stored my devlog articles in files on the server and had WordPress read those files via FTP (File Transfer Protocol).
Why I Stopped Using FTP
When storing files via FTP, I had to add the Google tag used to record page views to each page individually. I had to obtain the tag through Google Analytics, and the process was somewhat complicated. Getting a new tag every time I wrote an article felt like a lot of work. With WordPress, visitor data can be managed centrally, making the process much easier.
WordPress also allows me to use related-content links and the site's shared header and footer. This makes it easier for visitors to explore other content on the site, so I decided to move the devlog to WordPress.
What Made the Process Difficult
The main challenge was finding a way to work around the WAF while managing everything in WordPress. At first, I tried saving each item in a meta box (an input field in the editing screen), but that did not work well. I then tried saving the required information in the main content editor, but that did not work either. In the end, I adopted a hybrid approach: use the meta boxes whenever saving works, and read the files stored via FTP whenever saving through the meta boxes fails.
The idea was simple: “If Plan A doesn't work, try Plan B.” It took many rounds of code revisions with Claude to get to this solution.
What's Improved in the WordPress Version
Normally, I create related links by writing the required code in a Custom HTML block. This time, I built a system to automate the process. I added a “Related Items” field to the article editor. When I enter a URL there, the system retrieves and displays a thumbnail or a social media image.
The links originally consisted of text only, but I thought thumbnails would make them more exciting, so I switched to thumbnail links. I also added a subtle wobble animation to the thumbnails. On a computer, a hover effect can enlarge a linked image when you move the mouse over it. However, hover effects do not work the same way on smartphones, so I created a shared animation that can be enjoyed on both computers and smartphones.
⭐ The new and improved devlog is easier to use and more powerful. Come check it out! 😊
Want to learn more about the entire development process documented with ChatGPT? Read the detailed article here:
👉 Read the full development story: From FTP to WordPress

コメント