Articles of functions

Pass info from functions.php to plugin

What is the best way to pass some information from functions.php to a plugin? I need to give a user the ability to pass a piece of data from their functions.php file to my plugin. (It can be any data, just something that I can check for; it can be a variable’s value, or even […]

Display Password Protected external RSS in wordpress template

I am using the below code to show external rss feed in my wordpress blog page template: <?php include_once(ABSPATH . WPINC . ‘/rss.php’); $rss = fetch_rss(‘’); $maxitems = 10; $items = array_slice($rss->items, 0, $maxitems); ?> <ul class=”arrow”> <?php if (empty($items)): ?> <li>No items</li> <?php else: foreach ( $items as $item ): ?> <li> <a href='<?php […]

How to use return in my custom function instead of echo

I’m creating a function in functions.php with a custom hook, and from what I’ve read somewhere, it’s good practice to return instead of use echo in a WordPress function? Correct me if I’m wrong. Anyway, so with echo, my function works, but breaks everything else. With return, the function is no longer outputting anything, but […]

get_post_type() in in_array doesn't work for some reason

I am trying to create some function for metaboxes and some reason i can’t get get_post_type to work in in_array. Everything else seems to work in testing but in_array nope. This is the function that i have $metabox = array( ‘metabox_one’ => array( ‘title’ => ‘First’, ‘screen’ => array( ‘post’ ) ), ‘metabox_two’ => array( […]

Is it possible to change any of the HTML/URL returned from the_category()

I’ve found this is on of my theme files: <?php the_category( ‘ ‘ ) ?> Ideally I’d like to wrap the whole thing in a function and replace some of the URL’s being output, but I don’t seem to be able to affect the output at all: <?php updateToPerfectURLs(the_category( ‘ ‘ )); ?> Ultimately I […]

WP_Query in functions.php overrides global $post object, even with wp_reset_query()

I’ve written a function that grabs all posts that are drafts and puts them as a dropdown in my toolbar for easy access to complete. This works just fine. The problem is that it seems to mess with my global $post object, specifically when called in my post/page editor. So if I’m in my post […]

Ninja form Redirect depending on text field content

I’m using Ninja Forms and their extension to do front-end posts. They have a function that is supposed to allow you to redirect to a specific page depending on values from the form. my purpose is to have a form, in which the user writes a text, and is then redirected to a customized url […]

How to rename “Publish” metabox title in post screen

I’ve looked everywhere trying to find how to rename the “Publish” metabox title in the WordPress backend post screen. There’s help for every other metabox for changing titles and there’s help for changing everything but the title for the Publish metabox. I’m sure it’s simple but I’m just not getting close.

Programmatically set page template based on page ID

How would I set the page template based on the ID? I have Redux Framework installed in my site and one of the options is to set a registration page. On this page, I want to use a specific template, but on others it should use the default templates. I have had it half-working with […]

override pluggable.php functions

I just not only want to override a pluggable function (wp_new_user_notification) but I want to make sure that if any other plugin is overriding the same function, so my function , override that too or I want my overridden function to work instead of other plugin that is overriding the same function (wp_new_user_notification). May be […]