Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function _load_textdomain_just_in_time was called incorrectly - error with multisite setup #339

Open
ankitguptaindia opened this issue Jan 20, 2025 · 1 comment
Labels
type:bug Something isn’t working.
Milestone

Comments

@ankitguptaindia
Copy link
Member

ankitguptaindia commented Jan 20, 2025

Describe the bug

When activating the Restricted Site Access plugin on a WordPress multisite network, the following error appears in debug logs. This issue occurs specifically in a multisite setup when a subsite's language is changed to a non-English language.
The plugin functions correctly on a single-site installation but fails on multisite due to translation loading happening too early in the WordPress lifecycle.

https://wordpress.org/support/topic/notice-with-wp-6-7/

Steps to Reproduce the Error

  1. Set up a WordPress Multisite Network

    • Install and configure WordPress as a multisite network.
    • Choose the subfolder structure when setting up the network.
  2. Add a New Subsite

    • Navigate to Network Admin > Sites > Add New
    • Create a subsite under the subfolder structure (e.g., example.com/subsite).
  3. Activate the Plugin Network-wide

    • Go to Network Admin > Plugins
    • Install and Network Activate the plugin that triggers the error.
  4. Change the Subsite Language

    • Navigate to Dashboard > Settings > General of the newly created subsite.
    • Change the Site Language to a language other than English (e.g., French or Spanish).
    • Save the changes.
  5. Enable Debug Mode

  6. Reload the Subsite

    • Visit the subsite's frontend (example.com/subsite) or dashboard.
  7. Check the Error Log

    • Open the wp-content/debug.log file to verify if the following error is logged:
      PHP Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the restricted-site-access domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.)
      

Screenshots, screen recording, code snippet

Image

Environment information

` ### wp-core ###

version: 6.7.1
site_language: en_US
user_language: en_US
timezone: +00:00
permalink: /blog/%year%/%monthnum%/%day%/%postname%/
https_status: false
multisite: true
user_registration: false
blog_public: 2
default_comment_status: open
environment_type: local
site_id: 1
site_count: 2
network_count: 1
user_count: 2
dotorg_communication: true

wp-active-theme

name: Twenty Twenty-Five (twentytwentyfive)
version: 1.0
author: the WordPress team
author_website: https://wordpress.org
parent_theme: none
theme_features: core-block-patterns, post-thumbnails, responsive-embeds, editor-styles, html5, automatic-feed-links, widgets-block-editor, block-templates, post-formats, editor-style
theme_path: /Users/ank/Local Sites/multi-site-setup/app/public/wp-content/themes/twentytwentyfive
auto_update: Disabled

wp-themes-inactive (2)

Twenty Twenty-Four: version: 1.3, author: the WordPress team, Auto-updates disabled
Twenty Twenty-Three: version: 1.6, author: the WordPress team, Auto-updates disabled

wp-plugins-active (2)

Debug Log Helper: version: 1.5.3, author: Lukman Nakib, Auto-updates disabled
Restricted Site Access: version: 7.5.1, author: 10up, Auto-updates disabled

wp-media

image_editor: WP_Image_Editor_Imagick
imagick_module_version: 1809
imagemagick_version: ImageMagick 7.1.1-15 Q16 x86_64 98eceff6a:20230729 https://imagemagick.org
imagick_version: 3.7.0
file_uploads: 1
post_max_size: 1000M
upload_max_filesize: 300M
max_effective_size: 300 MB
max_file_uploads: 20
imagick_limits:
imagick::RESOURCETYPE_AREA: 144 GB
imagick::RESOURCETYPE_DISK: 9.2233720368548E+18
imagick::RESOURCETYPE_FILE: 7872
imagick::RESOURCETYPE_MAP: 72 GB
imagick::RESOURCETYPE_MEMORY: 36 GB
imagick::RESOURCETYPE_THREAD: 1
imagick::RESOURCETYPE_TIME: 9.2233720368548E+18
imagemagick_file_formats: 3FR, 3G2, 3GP, AAI, AI, APNG, ART, ARW, ASHLAR, AVI, AVS, BAYER, BAYERA, BGR, BGRA, BGRO, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CR3, CRW, CUBE, CUR, CUT, DATA, DCM, DCR, DCRAW, DCX, DDS, DFONT, DNG, DOT, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FARBFELD, FAX, FF, FITS, FL32, FLV, FRACTAL, FTS, FTXT, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, GV, HALD, HDR, HISTOGRAM, HRZ, HTM, HTML, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, JNG, JNX, JPE, JPEG, JPG, JPS, JSON, JXL, K25, KDC, KERNEL, LABEL, M2V, M4V, MAC, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MPO, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORA, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PHM, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, POCKETMOD, PPM, PS, PS2, PS3, PSB, PSD, PTIF, PWP, QOI, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGB565, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, STRIMG, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TM2, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIFF, VIPS, VST, WBMP, WEBM, WEBP, WMV, WPG, X3F, XBM, XC, XCF, XPM, XPS, XV, YAML, YCbCr, YCbCrA, YUV
gd_version: bundled (2.1.0 compatible)
gd_formats: GIF, JPEG, PNG, WebP, BMP
ghostscript_version: 9.56.1

wp-server

server_architecture: Darwin 23.6.0 x86_64
httpd_software: nginx/1.26.1
php_version: 8.3.0 64bit
php_sapi: fpm-fcgi
max_input_variables: 4000
time_limit: 1200
memory_limit: 256M
max_input_time: 600
upload_max_filesize: 300M
php_post_max_size: 1000M
curl_version: 8.7.1 (SecureTransport) LibreSSL/3.3.6
suhosin: false
imagick_availability: true
pretty_permalinks: true
current: 2025-01-20T14:06:07+00:00
utc-time: Monday, 20-Jan-25 14:06:07 UTC
server-time: 2025-01-20T14:06:04+00:00

wp-database

extension: mysqli
server_version: 8.0.35
client_version: mysqlnd 8.3.0
max_allowed_packet: 16777216
max_connections: 151

wp-constants

WP_HOME: undefined
WP_SITEURL: undefined
WP_CONTENT_DIR: /Users/ank/Local Sites/multi-site-setup/app/public/wp-content
WP_PLUGIN_DIR: /Users/ank/Local Sites/multi-site-setup/app/public/wp-content/plugins
WP_MEMORY_LIMIT: 64M
WP_MAX_MEMORY_LIMIT: 256M
WP_DEBUG: true
WP_DEBUG_DISPLAY: true
WP_DEBUG_LOG: /Users/ank/Local Sites/multi-site-setup/app/public/wp-content/debug-678e0a763c624.log
SCRIPT_DEBUG: true
WP_CACHE: false
CONCATENATE_SCRIPTS: undefined
COMPRESS_SCRIPTS: undefined
COMPRESS_CSS: undefined
WP_ENVIRONMENT_TYPE: local
WP_DEVELOPMENT_MODE: undefined
DB_CHARSET: utf8
DB_COLLATE: undefined

wp-filesystem

wordpress: writable
wp-content: writable
uploads: writable
plugins: writable
themes: writable
fonts: not writable

`

@ankitguptaindia ankitguptaindia added the type:bug Something isn’t working. label Jan 20, 2025
@jeffpaul jeffpaul added this to the 7.6.0 milestone Jan 20, 2025
@jeffpaul jeffpaul moved this from Incoming to To Do in Open Source Practice Jan 20, 2025
@ankitguptaindia
Copy link
Member Author

@10up/open-source-practice Could you please help with fixes? Thanks!

@ankitguptaindia ankitguptaindia changed the title Function _load_textdomain_just_in_time was called incorrectly with multisite setup Function _load_textdomain_just_in_time was called incorrectly - error with multisite setup Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn’t working.
Projects
Status: To Do
Development

No branches or pull requests

2 participants