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
- How to redirect to settings page once the plugin is activated?
- Prevent network activation of plugin
- Default table collation on plugin activation?
- Using a database view = evil incarnate?
- Getting wrong relationship value in $args in wp_Query?
- WordPress and multithreading
- What is the added “complexity” of custom tables?
- How is the data stored in the database?
- How to modify post content before writing to database?
- Actions or filters fired when data is saved in a custom table
- Call activation hook multiple times
- 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?
- WordPress: After Gutenberg plugin migration to block.json the localization/ translations with PolyGlot in JavaScript does not work anymore
- Plugin activation error due to unexpected output
- How to store data for posts/pages built with drag-n-drop builder?
- Plugin Localization
- Is it possible to check is loaded language files correctly with WordPress plugin?
- What for the tables ending with the meta used in database of wordpress?
- Creating table with plugin is not working
- dbDelta() Error – Incorrect index name ” for query ALTER TABLE
- Default Plugin Settings Not Writing to Database
- Update/insert only a column of database table
- How to Create database table when Plugin installed/activated, and delete database when Plugin deleted
- Should shorcodes in i18n plugins be translated and if so, how?
- I’m designing a plugin to create database indexes. Suggestions?
- Plugin translations not installed but… strings are translated!
- WordPress database error for query INSERT INTO
- How to connect to AWS RDS external database (not for the core WordPress db)
- .mo translation strings not loading in PHP scripts that handle AJAX calls
- Using WPDB to output raw XML fails because of wp-blog-header.php
- Are there any scripts, classes, and/or functions built-in to WP for a plugin to export/import its saved data from wp_options?
- Strange issue saving custom field data for a WooCommerce order
- Generate JSON files for language translation from po file without wp-cli i18n make-json
- 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
- Translation per IP location [closed]
- Translate slug in WPMU with PO files
- Optimising a big WordPress site
- dbDelta SQL Query Not Working
- What is the best way to store a few fields?
- Plugin: database creation
- Delete data from database using row action
- How do I have now a duplicated user entry if this is not allowed (and I cannot replicate it)?
- 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
- 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?
- 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?
- Two different wordpress sites – same server and IP address. Gaining Access to database 1 of 2
- Translating plugin settings page – dropdown list
- Using HTML links within translatable string
- 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
- Error code when migrate
- Include external po file for 3th party plugin to theme
- 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
- Custom Plugin activation error in Multisite
- Use admin-post to submit form data to external database
- 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
- Associating special meaning with user id 0
- 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
- What method should I use to store my plugin data (multi level menus with options on each item)
- How to add additional field in a table row after creating a table?
- Deactivate plugin on registration
- Problem with Poedit [closed]
- How to translate WP plugin name?
- 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?
- get the queried_object of an url
- Leveraging Core Functionality in Icon Upload Plugin [closed]
- Can I log the searches that are returning 404 in the DB?
- Programmatically creating posts based on external JSON feed (asynchronously)
- My activator class isn’t running the code inside