Case 1 – is_rtl() is not working because it has been called directly. To use such contditional tags in WordPress, query should already be run. So such function should be used inside the function hooked to appropriate hook. Since it is called directly, its value will be always false.
See https://developer.wordpress.org/themes/basics/conditional-tags/#where-to-use-conditional-tags
Case 2 – It is working because you can using this tag inside the function hooked to admin_footer. So, is_rtl() will give you appropriate value.
So, if admin_footer is not working for you then, you need to check which hook is appropriate for you and use is_rtl() inside the function hooked properly.
Related Posts:
- How to make plugin required in a wp theme without using php conditional statements when calling an individual function from that plugin?
- Is it possible to stop selected plugins from loading on certain template pages?
- Hide wordpress plugins from list
- Automatically install wordpress plugin at theme activation
- When coding a WordPress theme, where does the theme (i.e. the presentation) end and the plugin (i.e. the functionality) begin?
- Adding a text domain to every __(), _e() and __n() gettext call without a plan to create own translations
- Which functions in theme or plugin load first
- How to hide fields from my user profiles
- How to make my plugin theme-independent?
- Add custom buttons with custom actions in Edit Post screen in WordPress?
- Code in theme functions.php faster than with a plugin?
- Autoload via composer in plugin interference
- Workflow and best practice for documentation [closed]
- Is there a quick way to inject i18n domain into theme/plugin files?
- WordPress language switcher
- Showing Co-Authors on post page
- WP theme with Backbone
- Include Max mega menu Plugin into theme
- How to include plugin without activation?
- Custom Taxonomy Tag Search
- wordpress theme backend admin only
- Check if we’re viewing an event
- How does WP handle multiple matching rewrite rules?
- Menus, but not by theme location
- How to get current post user id
- Events Made Easy Plugin – Duplicate Title Tags
- What is the correct way to update both WP/plugins/themes without breaking the site?
- Redux Framework has an embedded demo. Click here to activate the sample config file
- Not getting author rank when using return
- How to Display a Plugin function (content) on frontpage using index.php
- The problem with WordPress Importer
- how to give a user a role?
- Display post lists in 2nd paragraph
- Making sure that a plugin’s scripts and stylesheets are included for dynamicaly loaded content
- How can I position ShareThis buttons manually when using the plug-in? [closed]
- Plugin can not display in my custom theme
- How to use get_template part in the plugin?
- Overriding Parent Theme… will cause plugins failure?
- WordPress premium theme development [duplicate]
- How can I show a different theme for admin users? WP 3.8+
- How to show the number of website visitors in my theme
- How to write “alt” tag in image for wordpress code?
- Shortcode Attributes to Return different $_POST
- What form should the $query media query array have for an Elementor page builder function? [closed]
- Include Minit plugin in theme [closed]
- Managing wordpress Themes & plugins for multisite
- Set up functions to be overridden without using function_exists() by short-circuiting them?
- WordPress custom post type image in RSS
- Inserting Plugins Into Blank Space of Externally Designed WordPress Theme
- What’s the right way to implement functions in footer.php
- display unique post per category
- Polldaddy doesn’t show up on own theme
- How to add an admin alert for missing plugins
- Is there a way to insert multiple images into a post at the same time without using a gallery?
- Is there a way to keep youtube videos from displaying on home page, and display only on single posts?
- Yoast SEO Plug In and my Theme duplicating code. Need some feedback on what to do? [closed]
- Janrain/Simple Modal under Redirected Domain
- Warning: Attempt to read property “ID” on null in C:\xampp\htdocs\Nnamdi1\wp-content\plugins\elementor\core\base\document.php on line 250 [closed]
- How to get authors who have added the post in the specific custom post type
- woocommerce remove coupon link does not work
- require_once not working in plugin wordpress
- How to override any plugin file in the child theme
- how to display recent post by category on home page
- Unpublished Pages Failing To Appear On Custom Path
- How to Add call button on a featured image in a wpsite? check the slap king image, there are two buttons on the featured image
- WordPress hierarchy clarification, does post_type_archive take precedence over taxonomy-term archive?
- How can I find related learndash course id from woocommerce product object?
- How to get a post views count using ‘WordPress popular posts’ plugin
- Using Shortcode Result In Custom HTML Block (Using Google Sheet JQuery Result As NumScroller data-max)
- Disqus comment system not show
- How to use plugin’s shortcode in custom design? [closed]
- Remove action added in plugin class from theme
- Can you develop themes and plugins while using the hosting services BlueHost? [closed]
- Product catalogue in WordPress
- Contact form function should be in functions.php or in a plugin file?
- how to add custom css at top above all css file for specific url
- Is it possible to restrict content in wordpress?
- How to add wordpress plugins in along with my standalone theme
- Showing ads in the specific category and its sub-categories
- Breadcrumb is not generating the correct post page url
- How can I add different menus (different style menu) on each page?
- Site is setup statically – how to make it content managable?
- How can I make a website with dynamic features with wordpress?
- WooCommerce custom query and paging: Not Found error
- How to add image for custom taxonomy
- Javascript as Jquery Function Call?
- Detect if you’re in the “Frontend Editor” mode in Visual Composer WordPress [closed]
- How can I convert a complete bootstrap template into a WordPress template? [closed]
- Can anyone tell some online tuts for plugin development for beginner? [closed]
- How to escape html code?
- manage_{taxonomy}_custom_column not working
- Is website for online game guides doable in WordPress? [closed]
- add_meta_box showing blank screen in my page
- How to create an Info Box on WordPress [closed]
- How to make content as required in custom post type?
- What are Seeds? [closed]
- Best approach to change mobile background image and adding its class
- Frontend Enqueued Files in the Backend
- Automatically install bundled plugins during theme activation?
- Gutenberg Blocks and Elementor