never* execute code outside of hooks as you are more likely to call a function or use a variable before they were declared and initialized.
your code should be
function css() {
if (ot_get_option('css', false) != false) {
echo'<style>'.ot_get_option('css').'</style>';
}
}
add_action( 'wp_head', 'css', 100 );
*never say never, but this is a rule to follow unless you have a very explicit reason to ignore it.
Related Posts:
- How to save Uploaded image in custom option panel?
- How to add an export function to a custom Option Theme Page
- Theme options WP Editor
- Simple custom theme option not being saved
- Why does the ‘wp_nav_menu’ function work only until a menu is created?
- Image rotation fails to regenerate custom sized thumbnail
- Generating dynamic css into custom file [closed]
- Turn get_posts as string into an array for use in theme admin options
- Show some menu sub items as dropdown under a menu item
- $_Get and &_REQUEST Index Undefined on Functions.php
- call_user_func_array() expects parameter 1 to be a valid callback, function
- Adding theme option values as custom body class
- How to add or delete default value theme options while activate and deactivate theme
- How can I stop the hook from breaking the login/logout function?
- Adding a meta box fields to child theme options page
- theme options not saving
- Hiding Google Analytics code based on theme options
- Why don’t ‘wp_nav_menu’ CSS classes work until a menu is created?
- What’s the difference between esc_html, esc_attr, esc_html_e, and so on?
- Is it possible to rename a post format?
- Is there a hook or function I can use to display all theme files being used on a current page?
- How to paginate the get_users function?
- How can I remove the title “leave a reply” in the comment box in twentyeleven?
- Child theme – overriding add_image_size by a child theme [duplicate]
- Check if has any sidebar active on current page
- Compare post levels and user levels wishlist member
- Change ul class=”children” for wp_list_pages?
- Target a certain page within wordpress backend (admin) i.e. Pages > About
- Login using the password from protected pages
- Remove tag on my RSS Feed
- Automated mark posts as featured every day
- Enqueuing External Javascript functions.php
- Child Theme Not Overriding Parent Theme
- Function to wrap the_content in a div
- How to run a function once on every post in database?
- Date/time limitation of posts where function must be executed
- Custom image size in Media Dropdown
- Trouble using antispambot()
- Polylang: pll_e() & pll__() on functions.php, doesn’t work
- Post Pagination Showing Same Posts Every Page
- How to filter a table in post content without plugins? [closed]
- Inserting a functions output after the content
- Having issues with a foreach inside of a shortcode with ACF gallery
- Don’t delete a page if it holds users
- Change label for registration Fields
- Warning: : DOMDocument::loadHTML(): Empty string supplied as input in functions.php when adding classes to post images
- Remove stylesheets from Campaign Monitor plugin
- woocommerce change currency per category [closed]
- I can’t enqueue my scripts – They literally aren’t being added to my site
- Using wp_redirect and .htaccess to re-route searches (and pass along the remaining GET vars)
- Multisite 404 on pages – rewrite error breaks database
- Function that outputs second theme url
- Trying to register script in footer
- register_sidebar_widget is deprecated since version 2.8! Use wp_register_sidebar_widget() instead
- Require file in functions from theme directory using PHP
- Can I have an additional functions.php file in WordPress?
- Shotcode argument issues
- Remove Custuomize Sections
- Adding an option to a shortcode
- How can I show immediate and/or parents in a title?
- Add Login/Logout Menu Item to Primary Nav “My Account” Submenu [Woocommerce] [closed]
- Need help with customalert that it would read on a normal page, but not in WordPress
- Child theme function.php causes fatal error
- Best way to disable sidebars on posts (only)?
- How to override this theme function in child theme
- How to print the current post depth as update notification?
- How to safely edit functions.php
- Linking Javascript in functions.php file
- Enqueueing scripts selectively & activation where needed
- Overwriting TwentyTwelve template file with child theme template, but lower in the hierarchy
- Using One Function To Create Two Different Shortcodes
- Change Page Title
- How to Not Show posts on Category page?
- Put images in the media from url functions
- Paragraph spaces in email template function
- Is it possible to load recaptcha script only in url with fragment identifier (#)?
- page shows short code not output
- Including Font Awesome in a Custom Theme
- Scheduled post delete – can’t pass the cron arguments
- Prevent function from triggering on current page
- Assign IDs to headings in ACF using functions.php
- How would I correctly implement a new if statement in a child functions file?
- Multiple Notifications SetInterval
- Child Theme not loading multiple stylesheets
- How To Show Shortcodes In WordPress Custom Fields?
- Language Switch Function
- How to debug function file causing white screen
- Post date on Custom field
- Fatal error: Call to undefined function add_action() – an untouched problem
- Author info does not show up when author has no posts
- How to wp_enqueue_script with html?
- Load CSS conditional on custom field is present
- Modify sub_menu function to show pages below a specifically set page
- Add custom class to all URLs on entire site
- Unregistering custom tinymce plugin?
- Combining wp_current_user() and a variable
- Init hook for header send
- site_url is not honoring scheme
- Setcookie not setting cookies anywhere except admin
- WooCommerce, change “Add to Cart” to “Link to Product”, only for specific categories