Help Center
Find answers or browse our knowledge base.
Latest Questions
📘Core Database Changes File: db_changes.php
Purpose: db_changes.php
returns an array of injection rules the installer uses to insert small snippets into core files. Each rule must match the target file's exact marker text.
Format
'relative/path/to/file.php',
'marker_code' => 'exact text to find',
'hook_code' => 'code to insert',
'position' => 'before' | 'after' | 'replace'
],
...
];
Example A — Inject , users.user_something
after users.user_verified
in the long $get_profile SELECT
'profile.php', // change to actual file path that contains the SELECT
'marker_code' => "users.user_verified,",
'hook_code' => " users.user_something",
'position' => 'after'
],
// Example B follows...
];
Why this works: the marker "users.user_verified,"
is matched exactly; the installer inserts the hook text immediately after, producing:
..., users.user_verified, users.user_something, users.user_subscribed, ...
Example B — Inject , user_picture
after user_verified
in the $get_users SELECT
'profile.php',
'marker_code' => "users.user_verified,",
'hook_code' => " users.user_something",
'position' => 'after'
],
// this rule injects user_picture
[
'target_file' => 'includes/class-user.php', // change to actual file path for the get_users query
'marker_code' => "user_verified",
'hook_code' => ", user_picture",
'position' => 'after'
]
];
Result example:
SELECT ... user_subscribed, user_verified, user_picture
FROM users
...
Best practices / gotchas
- Exact match required: copy-paste the marker substring exactly as it appears (including comma/space).
- Prefer short, unique markers (e.g.
"users.user_verified,"
rather than just"verified"
). - Multiline SQL: match a fragment that sits on a single line (avoid matching across newlines).
- Comma handling: if marker already ends with a comma, inject without an extra comma; if not, include the leading comma in
hook_code
. - Multiple occurrences: if the marker appears more than once, injection may affect the first match — make marker more specific if needed.
- Test on staging: installer creates backups but always verify before production.
Was this answer helpful?
You must login to vote.
0 found this helpful,
0 did not
How could it be better?
What went wrong?
Thank you for your feedback!