It could be due to a hook firing sequence issue. When are you hooking your function?
The safest way to detect your current user is to fire on wp_login action. Someone reported the need to call it late.
The codex recommends to use wp_get_current_user() functon on or after the init
hook.
Related Posts:
- Versioning @import of parent theme’s style.css
- How to add code to Header.php in a child theme?
- Why does my child theme CSS get called twice?
- How do themes provide support for child themes?
- Attributing a version number to a child theme’s main stylesheet
- how do I queue my Child stylesheet/s *after* every Parent stylesheet/statement?
- Why is the Child Theme Stylesheet Not Loading?
- Hiding Parent Theme
- how to call files in child theme?
- Do all files in child theme override the parent?
- Child theme showing a blank page
- Child theme preview missing
- Child Theme Performance
- Under heavy cache conditions, updating the parent theme don’t reflect changes with child theme enabled
- How can you change default color scheme in a Twenty Fifteen child theme?
- Enqueue styles properly in a child theme and stylesheets location
- Proper way to make a tweaked theme into child-theme setting?
- Promoting child theme to stand alone
- Activating child theme returns “active theme is broken”
- How are updates to the style.css file in child theme recognized?
- Can’t override footer.php in child theme
- Recommended way to load / enqueue parent and child stylesheet to enable cache busting
- HTML head-tag get broken in my child theme
- iPhone Safari full size & PC versions different
- Where to put custom PHP files in a child theme?
- Where is wp-content/themes folder?
- Why is “get_template_directory_uri” pointing to child theme?
- Priority loading file css in child theme
- Is my child theme working properly
- Enqueue Child CSS to Load After Bootstrap CDN
- How to add child theme after using parent theme for long
- Overriding a parent theme folder in the child theme
- How to remove a script that was queued up in the footer in a parent theme
- Prevent a base themes css file from loading
- PHP loop that selects posts with a particular in-post option
- Child them function.php ‘parent-style’: should I name this as parent theme name?
- Child Theme Translations with PoEdit
- Someone created a child theme, but I need to modify it to reorder content. How do I access the child theme?
- Remote install won’t find Parent theme when intalling Child Theme, but local install does
- configuration for child theme
- How do add a the style-mobile css from the main theme to the child theme?
- Child Header.php Not Showing On Other Pages
- WOW.js animations work on one server, copied to new server, and stop working [closed]
- How to extend parent theme sections and settings to Options Tree
- Localize strings for translation
- Add head and body function for google tag manager in child theme
- GET parent theme throws 500 error in console, site works fine
- Child theme does not load all style
- Can I add customizer sections in the Twenty Seventeen theme?
- Creating child-theme from other template files
- Child theme not overriding ‘includes’ folder on server – on localhost it does
- colorpicker WP 3.5 path to stylesheet when called from a child theme
- add function to thematic hooks [closed]
- Child style loads before all parent styles
- All Titles and Menus changed to “CHILD THEME LOADED”
- Override post-formats in child theme
- child theme – moved files from twentyeleven theme to child them, now not working
- Which is the child theme and which is the parent theme?
- Storefront theme : Add Categoy to recent products section
- Is there any way to put the Google Tag manager Identification code into the child theme?
- Creating a child theme: How do I find the template name of the parent directory?
- Show full post in category archive pages in twenty-nineteen theme
- Modifying a child theme
- In modifying a file in a subfolder in a child theme, do I need all the files in that sub folder in my child?
- design has been broken in WordPress child theme [closed]
- Child theme not importing parent styles
- style.css of child theme is not overwriting parents style.css for .box
- CSS stopped working after line 150 [closed]
- Override file in parent theme
- disable jscrollpane in specfic div [closed]
- Twenty ten or Twenty eleven as base for responsive child theme
- use child theme for mobile version
- How to replace function in child theme?
- Can only override parent theme styling with ‘!important’ in child style.css
- Can’t seem to get javascript code working from child theme
- Change child theme after updating parent theme
- template_include doesn’t work with child theme
- Including code from other themes in child themes
- Remove Stylesheet by URL that has not been enqueued
- How to fix error message to edit sidebar widget text on a livesite childtheme?
- Best practice when a theme already has a parent theme (so can’t create child theme)
- Child Theme Can’t Find Parent In a Folder
- Problems with child theme
- How to override styles from child theme if all the styles are in a folder?
- Alpha-store-child does not save changes
- why child theme style sheet in wordpress editor is blank?
- How to Create a Child Theme for a Site that Already has a lot of Customization?
- How to prevent funny characters on Home Page
- How to include only modifications in child theme?
- Change default header image in twenty fourteen child theme
- Child Theme > Template
- Functions.php in Child Theme – load JS
- creating a new child theme
- How to activate the child theme in WordPress?
- Selling a child-theme of twenty-thirteen is legal? [closed]
- What is __(arguments) in my functions.php
- How to override a theme template file with a child theme template file (of the same name)
- Child theme customizer preview doesn’t work/load
- theme.json should be in the child theme folder when using xxxx.json style located in the styles folder?
- Child theme css not loading when declared in parent functions