No, there’s no disadvantage to starting a session directly in your theme’s functions.php
.
However, it’s strange that starting your session on init
is not working for you. Could it perhaps be that output is being generated (perhaps a space or a line break) before init
? Could you turn WP_DEBUG
on and see if any notices or warnings are being shown?
Related Posts:
- How to Extend login session times to a Month
- WordPress Website with Login system
- Sessions in word press [duplicate]
- Ajax call always returns 0
- plugins_url vs plugin_dir_url
- Get list of years when posts have been published
- Where and how to put inline js in pages
- Is it possible to remove the “standard” post format?
- Do WordPress’ cron’s clean up expired transients?
- Warning/Notice about functions.php
- Is checking whether the blog is installed necessary?
- Displaying a random user with a shortcode
- Assign category using custom field?
- Should I ask a theme developer to use locate_template rather than require_once
- Customized wp_new_user_notification
- Should everything in functions.php be hooked or filtered?
- Updating users_can_register option?
- How to add an anonymous function in wordpress hooks by removing create_function
- Changing post category from dropdown
- How to update feed only 2-3 times a week (for Feedburner email)?
- Fatal error when trying to get admin email on contact form
- Is it good practice to use wpdb->query() function?
- img width and height attributes being set by get_the_post_thumbnail
- How to properly add NPM packages and integrate them in WordPress?
- wp_enqueue_script add integrity parameter
- Passing arguments to my function with do_action and add_action is not working
- change in form-checkout.php by using code in functions.php
- List child pages of specific page using shortcode
- Custom function in My Custom Functions returning 403
- Register vendor JS/CSS only on pages that require them?
- Adding HTML to the end of every post with the Block Editor
- Can I hide certain upload folders in media library [duplicate]
- Function issue with Walker_Nav_Menu [duplicate]
- functions.php How to add css/js depending on Template Name?
- wp_nav_menu, walker class, categories as classes of li
- Why is my page feed returning empty content?
- Add other social networks to TwentyNineteen_SVG_Icons class in child theme?
- Including a specific Javascript Script in a template. Is my code correct?
- Custom shortcodes not inserting into visual composer columns
- Redirect to another page if the user is logged in when pressing again the login button on menu bar
- Adding a colorbutton in tinymce dialog with current api
- Post meta not updating
- Accessing two databases wordpress
- Add a jQuery Function
- append to existing parent theme function
- Get category URL for current post
- How can I get the post id from within functions.php
- Check if Page Slug Exists, then display that Page’s Title
- Why doesn’t is_page(id) work in functions.php?
- I have problems with loading javascripts
- Enqueuing latest version of jQuery into a child theme returns a blank screen
- How do I change a parent theme’s function through the child theme?
- Dropline menus — seperators between children only?
- Echoing function into WordPress NextGen gallery
- does wp function the_content(); accept another tag inside
- How to parse a shortcode within a shortcode?
- Redirect to other page if login
- Prevent loading of functions
- 404 when enqueue_script using plugin_url
- WP Customizer API loaded into functions.php
- Get term slug by term id and then explode it
- Shortcode question
- call_user_func_array() expects parameter 1 to be a valid callback, function
- How to use get_posts() function in functions.php
- the_widget() inside functions.php
- How Can I add a menu to the theme from withen the function.php file
- define css class in functions.php
- Adding tables to the WordPress Editor
- Add Login and logout buttons to top menu bar
- implementing a centralized content “show-do-not-show” toggle?
- How to hide content on mobile in the functions.php file – woocommerce
- Load templates, pass arguments, and render output from functions.php
- How to load a css file depending on the current role
- WordPress Lite/Light
- How to add HTML into error message
- Add a word after the post url if it is within a specific category
- Is_Page doesnt detect my page
- Security when outputing wp_oembed_get code
- Show image after X para – center aligned
- Problems adding a new field to product in cart
- Function for Sticky Post on Categories causes issues with 404 behavior
- Get value of pre-populated Gravity forms field as variable in my function
- Will dequeueing in child theme functions.php file prevent Google Fonts from loading?
- Edit meta fields from within template
- What to do to have access to WordPress functions
- Adding a meta box fields to child theme options page
- Changing the color of post title [closed]
- Create html from function
- wp_list_pages change of children and anchor of parent
- Admin Panel errors because of functions.php
- WordPress not performing direct update
- Using Output from one Function and calling it into another
- How to add a class and title attribute to the link generated by next/previous post
- “Headers already sent” while trying to add a CSS file to my login page?
- Remove theme, change theme button and WP version on “Right Now” admin dashboard?
- Notice: Use of undefined constant REQUEST_URI – assumed ‘REQUEST_URI’ in ….functions.php on line 73
- Vimeo video play button color function
- User’s Comments Number: Storing it in a meta field for different uses
- Show one post per author and order by custom field
- Loading newest dependency javascript module file in functions.php