Load new translation file for plugin. WordPress example open

Load new translation file for plugin. WordPress example

Approved. Code works!
This is exactly the working code that is verified by the moderator or site administrators
Tested: PHP 5.6 +

Connects the specified translation file.

The function parses the .mo file specified in the parameters and adds the data from it to the WordPress translation data – to the $l10n global variable:

<?php
/*
Plugin Name: My Plugin
Plugin URI: https://mypluginsite.com/
Description: One of best plugins in the planet
Version: 1.0
Author: John 
Author URI: https://facebook.com/john
Licence: GPLv2 or later
Text Domain: myplugin
Domain Path: /lang
*/

function load_text_domain() {
    load_plugin_textdomain(
    'myplugin', 
    false,
    dirname(plugin_basename((__FILE__)).'/lang'),
    )
}

add_action('plugins_loaded', 'load_text_domain');
0

More

Leave a Reply

Your email address will not be published. Required fields are marked *

How many?: 22 + 22

lil-code© | 2022 - 2024
Go Top
Authorization
*
*
Registration
*
*
*
*
Password generation