Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Custom Field used to allow a Free Story; no longer works

First @TomJNowell is 100 percent right. It was the PHP and my ignorance of it.

Putting in the following code from a year-old backup seems to have fixed the issue in question, if not the underlying improvements that need to be made:

<?php 
    $key = 'Free Story';
    $themeta = get_post_meta($post->ID, $key, TRUE);
    if($themeta != '') {
    $free_story = 1; 
    }
 ?>

<?php if($_SESSION['auth'] == '1' OR $free_story == '1' ) { ?>

NOTE that $post_id from earlier has been replaced with the proper code to call the ID of the current post/page: $post->ID Also note that the TRUE value after $key appears to ask the meta to go through until it finds the $key (Free Story) I want and then operate on that value. I still don’t get what if(@themeta != ”) {$free_story = 1;} is saying. Is it saying that IF themeta is Null or empty, set $free_story to = 1?
Regardless, That’s a learning mission for me. Thank You Tom for your patience!

Related Posts:

  1. How to call plugin path in JS?
  2. Update Multiple Post Meta for the Same Post In One call?
  3. How can I make content disappear when a user logs in?
  4. How to save Clicks of a download link button while it doesn’t matter if we refresh the page or again login/logout
  5. Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
  6. How to use wp-ajax in wp-cron
  7. White text on white background in TinyMCE when wp_editor is called in WP 3.9
  8. Is it possible to filter the wp_footer() scripts, read the content, and insert them inline?
  9. How can I make the “Preview Post” button save and preview in the same window?
  10. Creating an Exit Confirmation Popup
  11. Difference between register_block_type & wp.blocks.registerBlockType
  12. Add multiple attributes to product from php
  13. Pass a php string to a javascript variable
  14. add mediaelement.js plugins into WordPress video player control bar
  15. Shortcode button dosent work for all posts. Work for first post only
  16. Is Wrapping intval() Around esc_attr() Redundant for Escaping Input?
  17. Pulling data from custom plugin settings using PHP shortcode and Javascript
  18. wordpress site | All-in-one-cufon IE Issue
  19. Assign / update custom field value for all posts (How can I assign only to posts without custom field value?)
  20. How to get the element ID from new menu list that added with add_filter()?
  21. Override Plugin Script Fucnction in WordPress
  22. add image crop function like in wp customizer
  23. Calculate price and display on woocommerce product single page under price (simple price, variable price) [closed]
  24. How to edit content before post update
  25. How to insert HTML/JavaScript form into WordPress page? [closed]
  26. How to get my plug-in, wrote in php, to refresh on its own every 5 minutes?
  27. Using TinyMCE in plugin?
  28. Using window.onload with Ubermenu
  29. Redirect to another page using contact form 7? [closed]
  30. JavaScript in a PHP plugin
  31. wordpress add_action() issue in ajax call
  32. Pass user role to javascript code inside body
  33. get specific value of a array | PHP
  34. How to get specific string/value from an array? php [closed]
  35. coding a WordPress AJAX Form using PHP to check if User is Logged Out and Show error
  36. Background Music WP [closed]
  37. How to use custom Javascript code inside a plugin?
  38. Adding a simple Javascript file with a plugin
  39. Social share buttons text shows up on post excerpts
  40. Plugin Admin panel checkbox unchecked after submit
  41. uncaught TypeError: Cannot read properties of null (reading ‘classList’) custom plugin
  42. Custom Plugin scripts from admin working in frontend
  43. Code for unique user visit count on every page WordPress
  44. Ajax call not working in wordpress through a plugin
  45. Send Array from JS to php file then insert it in wp database through a plugin
  46. Possible way of having multiple Gutenberg instances for a page?
  47. get_post_meta shortcode returns empty field
  48. Woocommerce add products to cart
  49. Calling PHP function with AJAX
  50. Why does my custom plugin only function correctly once per page?
  51. How to get a specific string from a url
  52. How can I create a secure file download in WordPress?
  53. front end editor creation for Restropress plug in – displaying information from a WP admin area, on a different URL
  54. Use AJAX to fetch Current Post Thumbnail for WordPress when Uploaded throughMedia Uploader Frontend
  55. Problem with wordpress has_action() function
  56. Multiple image selection custom widget
  57. Get and Update Most Meta Value as an array in HTML form
  58. Create a form and have custom menu display based on user answers?
  59. Woocommerce – Change variations output
  60. Speeding up WordPress on a Local Network
  61. Conditional Fields depending on checkboxes
  62. Caching of combined CSS and JS fails because of losing MIME types through combining by PHP
  63. Number format in thousands on highcharts in wpdatatable plugin
  64. Embed Javascript code to registered users only
  65. Same Title on two different post type with single custom taxonomy
  66. How to limit each front-end user to view just his own uploaded files on Amazon S3?
  67. How to create a dashboard for logged-in users with custom functionality? [closed]
  68. Creating a user ‘add custom field’ section
  69. Media Playlist Plugin
  70. How to set up php,javascript and css to allow for our finished product to be displayed within a page?
  71. How do I convince this button to do something when it is clicked?
  72. Can’t insert files in other inputs
  73. WordPress User Frontend Editing Custom Fields
  74. How do I output user_registered time in my correct timezone?
  75. How to tweak a plugin without preventing it from updating
  76. How to create post comparison in wordpress
  77. Adding a script & php to functions.php
  78. how to show selected options drop down menu values in attributes field in after saving post.php
  79. Refresh server side rendered block in Gutenberg without changing attributes or its content
  80. How do I call an action hook into wp_ajax hook callback function
  81. WordPress Gutenberg Custom Block the viewScript does not get loaded on the frontend when my block is inserted
  82. Can you open a media frame to sellect an attachment to associate with another attachment you are editing on an existing media frame?
  83. How to include code only on specific pages?
  84. How to Loop Plugin Option Field Set?
  85. How can I execute some small piece of PHP code in a sandbox area of my WP?
  86. Activating a single plugin via php
  87. How to redirect Old Post URL to new Post and keep Old post Comments?
  88. How to add pagination to wpbakery grid?
  89. Why wp_mail() function isn’t sending any emails and displaying ‘0’ in Chrome ‘Network’ response
  90. How to get number of Affected rows from wordpress dbDelta() function
  91. How to disable specific plugin in mobile version?
  92. Adding an Options Page to a Plugin
  93. How do I “get the next 10 posts after post_id == x”?
  94. Error with Image Slide plug-in/ s3slider in WP
  95. What is generating my meta og:description?
  96. Updating the Drag-To-Share eXtended share URLs?
  97. Changing “elapsed time” to “time remaining” on MP3-jPlayer audio player with CSS or PHP changes
  98. Customizing NEXTGEN Gallery To link images to pages
  99. How to trigger plugin migration code when plugin updates?
  100. How to Save Category and Delete Category in same Function
Categories plugins Tags javascript, php, plugins, post-meta
How to search through “post title” and “tags” using WP_Query?
How to change the canonical link from a category or taxonomy archive?

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress