I found the solution !
The problem was I loaded plugin domain only when plugins are loaded, not for the activation plugin.
It resolves my problem…
MyPLugin.php
class WPGroupSubs {
public function __construct(){
// Install needed components on plugin activation
/* need to add this */
register_activation_hook( __FILE__, array( $this, 'load_text_domain' ) );
register_activation_hook( __FILE__, array( $this, 'install' ) );
//Translation when plugins are loaded
add_action( 'plugins_loaded', array( $this, 'load_text_domain' ) );
...
}
public function load_text_domain(){
load_plugin_textdomain( $this->domain, false, plugin_basename( dirname( __FILE__ ) ) . '/translations' );
}
}
Related Posts:
- WordPress Fatal error: Uncaught Error: Call to undefined function dbDelta()
- WordPress plugin tables become corrupt
- Post meta vs separate database tables
- How to make a WordPress plugin translation ready?
- Is it mandatory to use $wpdb->prefix in custom tables
- Update Option Stored in Multi-Dimensional Array
- How to output message during plugin activation
- Prevent network activation of plugin
- Inserting Taxonomy Terms During a Plugin Activation?
- How to provide translations for a WordPress TinyMCE plugin?
- Using a database view = evil incarnate?
- Writing a plugin that notify my friends of new post that mentions(@) them
- WordPress and multithreading
- What is the correct way for plugins to create tables with special charset/collation considerations?
- Using wp_cron with custom time interval and the register activation hook
- Actions or filters fired when data is saved in a custom table
- Call activation hook multiple times
- Problems with localization
- Sample — test — data for large WordPress install
- Is there any reason only 1 (my) IP would be added to this table using $wpdn->insert?
- Can’t we use strings defined as PHP constants if we want to translate them in a plugin?
- why creating tables using $wpdb is not being executed while installing plugins?
- Plugin activation error due to unexpected output
- How to store data for posts/pages built with drag-n-drop builder?
- Plugin Localization
- Is there a naming convention for database tables created by a plugin?
- Version upgrade: can my plugin filter the SQL statements issued during a database upgrade?
- Saving data from block editor to the database
- Creating table with plugin is not working
- Settings not set after calling register_setting()
- How to i18n text coming from the db or from an external source
- dbDelta() Error – Incorrect index name ” for query ALTER TABLE
- Default Plugin Settings Not Writing to Database
- Update/insert only a column of database table
- Widget translation on my plugin
- Using WPDB to output raw XML fails because of wp-blog-header.php
- Strange issue saving custom field data for a WooCommerce order
- How to perform a heavy and long process in cron jobs?
- Form doesnt save to database
- Updating Woocommerce Settings API when WordPress Settings API saved and vise versa
- Is using custom table to suit business needs instead of transients a big hit to page load speed?
- Build a translation correcter plugin
- Plugin Development for registered users
- Translation per IP location [closed]
- Translate MCE button text/tooltip in custom plugin
- Optimising a big WordPress site
- wpdb->prepare and mysql UPDATE – how is it done?
- dbDelta SQL Query Not Working
- What is the best way to store a few fields?
- Plugin: database creation
- Show dynamic list of products from custom api of another database under same host
- WordPress Plugin Activate / Deactive Failing
- esc_html__() and __() not working within arrays
- How to prevent someone from entering strings without making it available for translation?
- Readme.txt seems to be cached but not the version
- Return Value of load_plugin_textdomain
- Alternative functions for mysql_free_result and mysql_ping in wordpress functions
- Make Database query only when option is updated
- Can we intercept user_login and user_pass from a wp_login_form?
- How best to handle database version dependence (from $wp_db_version)
- WP: Search and replace in DB programmatically
- Multiple array for post_content on plugin activation
- Class cannot be found, but it’s available in the file, I get: Fatal Error: Uncaught Error: Class ‘Blocks\Base\Activation’ not found
- Is hint for translator compulsory while internationalizing a string containing variables?
- Plugin Development: Storing and Manipulating Data That Fits JSON in Database
- How to translate wordpress backend to another language
- Plugin can’t be activated [closed]
- How do I debug an error that a plugin is causing?
- Update plugin settings option_name for big plugin update
- Borrowing of Previously Translated Strings by Child Plugin
- WordPress database error: [Query was empty] – using $wpdb->prepare()
- Translations only load from `wp-content/languages/plugins` but not from the plugin’s languages folder
- Include external po file for 3th party plugin to theme
- HTML Elements in my WP Plugin being generated in JS. Security and Translated Text Question about this method being used
- How to get inserted row IDs for bulk/batch insert with wpdb query?
- WordPress how do I echo SUM from a column of a MySQL table by user id AND type_operation
- Save in my custom admin page and redirect to the saved object
- Relational / Associate tables using native WordPress functionality
- Add language localisation to javascript alert?
- How and when would I implement some code which would take data from one part of the Db and put it in another?
- Why Worpdress doesn’t create table in database?
- Form and database, plugin development
- How to filter get_adjacent_post()?
- Refresh or redirect page after activate my plugin
- Plugin translation not being displayed
- I can install my plugin in localhost but not in my server
- Deactivate plugin on registration
- Problem with Poedit [closed]
- How to translate WP plugin name?
- How can I get a plugin to hook ‘dbdelta_queries’ — a filter used during version update?
- Running one-off cron jobs when WP_DISABLE_CRON is true: can I hit /wp-cron.php?
- how can a plugin return an error message on activation?
- Leveraging Core Functionality in Icon Upload Plugin [closed]
- Is there a canonical way for a plugin to install a mu-plugin or drop-in?
- WordPress database error: [Table ‘bitnami_wordpress.questions’ doesn’t exist]
- Save translation file of third party plugin in a custom plugin?
- multiple record insert creating many duplicate records
- Translations not making it into Block UI but work in the rest of the plugin
- How to use native wordpress translation domain inside a custom plugin?
- How to get list of ALL tables in the database?