I am trying to insert some php code to my WordPress website but it gives security warnings perhaps due to directly accessing $_POST
variable.
I am trying to walk away from the Singleton pattern when it comes to develop plugins for WordPress.
In the wordpress documentation for Global Variables, I did not find information about the $wp global variable.
@toscho left a comment to this answer which had me thinking again. How much trust should we have in the global scope, specially regarding the post globals like $post
?
People are often confused about how to get data from global objects/variables Question: In which ways can you inspect global variables? This Q was written…
Setting up a WP multisite instance – the client has an existing ontology / set of categories that they want to classify all content across the set of blogs. Also the desire is that any new categories would be added at the ‘network blog’ level and synced to the other blogs.
UPDATE: My original question has been solved, but this is turning into a valid discussion about why not to use global variables, so I am updating the question to reflect that. The solution was <?php global $category_link_prop; echo esc_url( $category_link_prop ); ?>
as @TomJNowell suggested.
I made a WordPress plugin like this:
I am trying to understand when and why I should use the global $post variable.
I have tried to do the following on a post page, outside the loop, and as expected it works.
I want to be able to echo the URL of the featured image of a post and after looking some on the web I found the following which works fine when I put it in a loop in my front page template.