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?
- 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?
- Default table collation on 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
- Getting wrong relationship value in $args in wp_Query?
- WordPress and multithreading
- Not sure the best way to save custom plugin data
- The ideal place for storing persistent PHP objects
- 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
- What is the added “complexity” of custom tables?
- Plugin development with unit tests
- How is the data stored in the database?
- Formatting of curly brackets array from WP database to get more readable output
- 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
- Problems with localization
- How does gettext works for translating readme file of plugin?
- Using HTML links within translatable string
- Plugin Development: Storing and Manipulating Data That Fits JSON in Database
- What might be the reason of Couldn’t fetch mysqli_result on another domain?
- 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?
- Clean way to initialize plugin in newly-added site when plugin has been network activated?
- Save temporary registration data
- Activate / Deactivate plugin
- Update plugin settings option_name for big plugin update
- $wpdb->update Issue
- Borrowing of Previously Translated Strings by Child Plugin
- dbdelta failing with error: “WordPress database error Table ‘wp_2_myPlugin’ already exists
- 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
- HTML Elements in my WP Plugin being generated in JS. Security and Translated Text Question about this method being used
- Why User_login key doesn’t work with wp_update_user()
- 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
- Load custom translation in custom plugin fails
- 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?
- WordPress doesn’t create table on plugin activation
- Insert Data into Database
- Update database record in plugin
- Translation not working for Constant strings in Plugin
- How and when would I implement some code which would take data from one part of the Db and put it in another?
- pull data from wordpress database
- Unable to show a message after plugin activation
- Load textdomain from global languages directory
- Ajax not working to insert, query and result data
- Why Worpdress doesn’t create table in database?
- Form and database, plugin development
- How to filter get_adjacent_post()?
- 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?
- Post data in wp-admin to external database
- 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?
- How to create a database table in WordPress using PHP
- get the queried_object of an url
- Leveraging Core Functionality in Icon Upload Plugin [closed]
- Is there a canonical way for a plugin to install a mu-plugin or drop-in?
- Can I log the searches that are returning 404 in the DB?
- Programmatically creating posts based on external JSON feed (asynchronously)
- WordPress database error: [Table ‘bitnami_wordpress.questions’ doesn’t exist]
- Save translation file of third party plugin in a custom plugin?
- My activator class isn’t running the code inside
- Making a user platform reachable by a qr code on a pin-back-button [closed]
- multiple record insert creating many duplicate records
- Translations not making it into Block UI but work in the rest of the plugin
- Issue with WordPress Plugin Activation Hook and Table Creation
- Custom Plugin Breaks Other Plugin Functions
- Custom database table entry edit page
- Update Cache on Save Instead of Clearing It?
- Images stored from external API not loading
- Is there a way to force plugins to use Flyway migrations for database changes?
- How to use native wordpress translation domain inside a custom plugin?