No, this is not okay. NO NO NO. Here’s my favourite Otto quote:
Inside all translation functions, no PHP variables are allowed in the
strings, for any reason, ever.
Otto explains this in more detail, but the simple way to say it is that translation calls are parsed, not executed . So your variable (let alone your function) may not be evaluated and the text-domain breaks.
So, you’re better off using a unique name like wpse241589
for your textdomain temporarily and do a search and replace once you have a better name.
Related Posts:
- What is a Theme textdomain?
- Issues with title-tag and document_title_parts
- Display random categories on the front page (Finding and Editing Theme Functions)
- How to get woocommerce inventory status [closed]
- TinyMCE custom styles remove class when switching styles
- Gettext details
- How to use get_template_directory_uri() to load an image that is in a sub-folder of my theme?
- Adding a text domain to every __(), _e() and __n() gettext call without a plan to create own translations
- Warning/Notice about functions.php
- Show/hide Widgets in Dashboard Based on Current Advanced Custom Fields Option
- Return only top-level navigation items from a menu using wp_get_nav_menu_items
- Organize functions.php
- How to override functions.php in child theme?
- Overriding core functions in child theme
- Theme elements not translating
- Change parent theme file function in child themes functions.php
- Add inline css to theme
- Dequeue Scripts and Style for Mobile not working?
- Displaying Widgets
- Dequeue script in template isn’t working
- Add external js file to footer with id
- Changing itemprop from logo to image on custom logo?
- How to add background image control to page admin controls?
- Best Practice for Syncing Local Development With Staging Development [closed]
- Overwrite Parent Theme add_image_size in Child Theme
- Show excerpt for only first post in query
- How to add css class to image attached in all the posts?
- How to call custom function from functions.php in site-wide template files?
- How to use thumbnails in gallery?
- Logic to Print/echo a css class only for 1st post and ignore all post after 1st? [closed]
- Is there a way to add a class to non current menu item?
- When using wp_enqueue_script(); in a theme why don’t we use add_action?
- How to use Internationalized human_time_diff() function in Chinese?
- is_dynamic_sidebar always returns true while using Jetpack visibility
- How to enable template page only for a post id page
- Why does the ‘wp_nav_menu’ function work only until a menu is created?
- Add caption functionality to custom WordPress theme
- is_customize_preview() like function to check if Customizer “Live Preview” in JavaScript
- Override a theme function in a child theme?
- translate the_title() with .po & .mo
- Pulling Twitter RSS feed not working as expected (fatal error)
- Translation of theme using child theme
- Use register_setting() in a loop
- Best practices regarding the creation of custom widgets?
- PHP 7.1 | Warning: A non-numeric value encountered in
- How to insert class in each list of categories?
- I can’t add CSS with functions.php
- Getting the teaser text without overriding global variables
- Combine two active_callbacks into one on theme customizer
- WP Customizer API loaded into functions.php
- call_user_func_array() expects parameter 1 to be a valid callback, function
- why can’t i add front.css to my frontpage.php
- “options.php” not found
- How to store a number (coming from cookie) into query vars for later usage in other filters?
- Is this an acceptable practice for WordPress theme development?
- What is the correct way to include my new functions and scripts in WordPress?
- wp_nav_menu work in functions.php but not in the theme
- Rewrite Question Mark in Post Template with URL Parameter for clean URLs
- contact form in template with jquery,validate and ajax
- Why a SlideShow (made using JQuery FlexSlider) can’t work if I load it form functions.php but work if I load it from my footer.php file? [closed]
- Why I can’t load my JavaScripts using an hook inside my functions.php file?
- Woocommerce Variable Product Dropdown for Custom Shop Template
- How to fix Function create_function() is deprecated in / themes
- Exclude specific post from query
- Advanced method to control cache of enqueued style/script
- WordPress wp_dequeue_script remove all other scripts
- Can I use ‘Featured Image’ as a hero image and a thumbnail?
- Is_Page doesnt detect my page
- Test CDN link from function.php or wp_enqueue_script/style?
- How to customize archive widget only for cpt?
- wp_title() return random number
- Why does echo on functions.php not yield result in source code?
- How to offset main query without affecting other queries and backend
- Change ‘Categories’ to ‘Topics’
- Add meta data in head from theme
- what is `get_section()` and how to use it?
- Remove External Links from WordPress posts Using add_filter() in Theme functions.php
- How to retrieve image IDs from shortcode content?
- HowTo: Add wrapper to columns shortcode?
- How to create admin ajax function for my contact form
- Class::$template_dir_path=get_template_directory();
- How to disable site title and description when custom header is uploaded on the customizer?
- wordpress not calling peliegro functions.php?
- Language switcher for subdomains
- How to add next height number in Order Attributes inside the Add new page. [duplicate]
- Load a Child Theme’s style.css just before the closing tag
- wp_nav_walker that interacts with widgets to setup mega menu
- Allow tags and attributes in post and pages content
- Add the title of a widget as an ID – for anchor links
- Add custom css to theme
- Why functions metaboxes is causing White Screen in Admin [closed]
- Getting error on function.php
- Why don’t ‘wp_nav_menu’ CSS classes work until a menu is created?
- How to get postId from the argument $block when register_block_type()?
- WordPress is adding pagination for all pages not only for blog page, How to remove pagination for all pages except blog/posts page?
- Setcookie not setting cookies anywhere except admin
- How to use webpack in WordPress theme? I want some scripts to load in the footer, some in the header and some with script parameters
- How can I able to exclude ‘Category’ and ‘Tag’ slug from the URL in WordPress without reloading to new site?
- No src and sizes attributes present on WordPress thumbnail images; the smallest image size is loaded irregardless of viewport size
- add_image_size() parameter four ($crop = true) is ignored: the_post_thumbnail() returns scaled image(s) instead of hard cropped