最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to add .ini file type to the plugin editor to read and edit?

programmeradmin0浏览0评论

Referring to /wp-admin/plugin-editor.php

The plugin editor does not include .ini files and I use that file type in a plugin to create dynamic message constants. I want to be able to edit that file via the editor.

I explored wp_doc_link_parse() but to no avail.

How can I add file types to the allowed list?

Referring to /wp-admin/plugin-editor.php

The plugin editor does not include .ini files and I use that file type in a plugin to create dynamic message constants. I want to be able to edit that file via the editor.

I explored wp_doc_link_parse() but to no avail.

How can I add file types to the allowed list?

Share Improve this question asked Jan 21, 2021 at 22:28 NadalNadal 896 bronze badges 3
  • Hmm... The question is a bit broad. It's like if I asked: "How can I buy an apple". There are a bazillion ways I can do it, but maybe only a couple of the answers are relevant to my setup and situation. Therefore... Can you elaborate a bit on, what you have tried and what errors you get, when you do so? And welcome to the forum! I hope we can figure out the pickle you're in. :-) – Zeth Commented Jan 26, 2021 at 8:55
  • @Zeth The question was clearly understood and accurately answered by Paul G, therefore there's no need for me to "elaborate a bit". Since you know of "bazillion ways [you] can do it", feel free to post them all. – Nadal Commented Jan 26, 2021 at 18:45
  • I didn't mean to step on anybodies toes. I'm glad that Paul G guessed which challenge you were facing. I was simply trying to help. – Zeth Commented Jan 27, 2021 at 12:46
Add a comment  | 

1 Answer 1

Reset to default 0

This code below should work if you add it to your functions.php in your theme:

add_filter( 'editable_extensions', function ( $default_types ) {
    $default_types[] = 'ini';
    return $default_types;
} );

Assumptions:

  • You're using at least PHP 5.3
  • You're using at least WordPress 4.9
发布评论

评论列表(0)

  1. 暂无评论