wp_get_current_user returns a WP_User object. You’ll need to pull the name out of that in order to send it try $current_user->display_name in your insert statement. On that note, you should absolutely not be inserting unsanitized user entered data into your database. Please look into SQL injection and input sanitization.
Related Posts:
- Why do templates contain so many PHP tag pairs?
- How do I use Shortcodes inside of HTML tags?
- Why would a GET variable one one page of a site cause a 404 error when a GET variable works on another page of a site?
- Where should I install a PHP library into WordPress so that code in a webpage can activate it?
- WordPress Shortcode and Dynamic CSS
- How do I edit the php/html for a particular post?
- Multiple pages on one with different HTML
- Add custom HTML to posts page
- Minify HTML, CSS, JS with PHPWee?
- Header has extra HTML block at top before my code
- Placing raw HTML inside a WordPress shortcode
- How to only show page id as body class?
- Shortcode content output but not in correct place
- An unwanted inline style is added to my body tag
- How to properly insert a link to a template in WordPress?
- HTML tags in bloginfo description
- Transferring working local PHP site to wordpress – with database (MySQL)
- Where in PHP do I move title and meta (date) to bottom of each blog section?
- Using the echo command adds unwanted br tags to source
- Use DOMDocument with ob_start breaks my HTML code
- Input data from email form not going to JSON file
- Different post styles depending on category
- Commenting out unwated CSS/scripts in HTML with PHP
- Auto 301 to full post permalink? (using : /archive/%post_id% to %post_name% )
- How do I add a custom css to all posts without affecting homepage css? [closed]
- Noscript not working as it should in wordpress site
- How to convert select to HTML with PHP tags inside of it [closed]
- Wrapping a Sidebar within
- Add Codepen animation as Preloader to WordPress
- HTML escaping data with ajax requests
- php within html within php
- HTML table attributes ignored
- php esc_html_e with an html link inside not working
- Using ob_start and ob_get_clean with wordpress shortcode
- How to edit HTML of my website on WordPress? [closed]
- WordPress wp-admin redirect and exception
- How to rename woocommerce-billing-fields
- Creating an image from a custom field
- WordPress forms submissions and PHP files
- How to add post meta in while loop?
- Adding function to child theme’s function.php
- Calling function in loop causes repeat data
- Link to page with posts of specific type
- Function Display article [closed]
- How to get the second slug of a page url?
- Displaying images outside the content
- custom add note meta box with add button in wordpress
- WordPress User Meta value variable into Google Gauge Chart
- List sub categories and corresponding posts of a parent category
- population category dropdown and sub category onselect
- PHP function for horizontal Woocommerce thumbnails and badges
- Using Google Analytics in an enqueued JS file
- dynamic php menu with hidden sub-categories only showing when the category name is clicked
- couldnt show short code atts in category
- Add Link to PHP message
- separate list of programs in html/javascript coming from php
- Drop down question
- How do I disable cache for a certain page?
- How can I edit the final HTML structure of the whole web page
- Install functionality for push notifications but WP-Theme has oddly-named, hidden source files [closed]
- AJAX and custom pages
- how to add functions to my function.php using a child theme?
- How can I create a shortcode from an html and php code written together
- Changable favicon
- Allowing HTML elements in title widgets spacing problem
- How to include different html tags in the header for different pages?
- Use PHP to inject HTML into before page renders?
- wordpress form action page not found
- How to make a parent page for author.php?
- Multisite – Display different header content based on which site is accessed
- html to posts, jpg to featured image, zip file contains jpg and html
- How do you change the tag font size in the repeater-template.php [closed]
- PHP tag in post content makes wordpress go crazy
- Font-Family does not looks like how it should be [closed]
- How to only fetch certain Tag ID’s
- Where to find the html for WordPress site? [closed]
- RegExp to EXCLUDE strip HTML (FOR SOMME) comments
- Pagination for div’s
- Add extra markup to WP menus
- How Can I Center the Logo in the Navigation Menu? [closed]
- What is the best way to get the first few post from WordPress in different divs using a loop?
- Run php function after html click after page refresh
- Get all the contents of taxonomy and sort by term
- Gallery requires a featured image but does not show it in posts/pages
- How to style this wp_list_pages markup
- How To: Simple domPDF Example
- Cant get theme to change footer color through theme customizer
- How do I modify the with wp_nav_menu()
- HTML in PHP problem [closed]
- Can you not edit the HTML and PHP of your WordPress without paying?
- Add multiple HTML attributes to an Elementor button
- Load wp_editor on button click
- Add topbar to static html page
- Why do I get a 404 error on my custom post type archive pagination?
- change div text and link for logged in users
- Font Awesome Icons as squares [closed]
- How to show correct td of table tags in wp_query loop
- Endpoint exists and shows up in My Account dashboard. Need to add endpoint to My Account DROPDOWN menu in Porto theme
- Editing stylehseet url in head section of WordPress
- How can we upload custom page files?