qid
int64
4
8.14M
question
stringlengths
20
48.3k
answers
list
date
stringlengths
10
10
metadata
list
input
stringlengths
12
45k
output
stringlengths
2
31.8k
223,231
<p>Note : This is not a duplicate question to <a href="https://wordpress.stackexchange.com/questions/222148/if-value-present-order-posts-by-two-consecutive-custom-fields">If value present, order posts by two consecutive custom fields</a>. After filtering a custom filed, I need to order by another custom filed. (The abo...
[ { "answer_id": 223278, "author": "Chetan", "author_id": 49618, "author_profile": "https://wordpress.stackexchange.com/users/49618", "pm_score": 0, "selected": false, "text": "<p>You can use meta query see below link it will help you.</p>\n\n<p><a href=\"https://make.wordpress.org/core/20...
2016/04/10
[ "https://wordpress.stackexchange.com/questions/223231", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/56652/" ]
Note : This is not a duplicate question to [If value present, order posts by two consecutive custom fields](https://wordpress.stackexchange.com/questions/222148/if-value-present-order-posts-by-two-consecutive-custom-fields). After filtering a custom filed, I need to order by another custom filed. (The above link explai...
You can try this by using meta query to filter results and then adding orderby to order results. Below arguments should work ``` $args = array( 'post_type' => array('post', 'video'), 'meta_key' => 'pp_like_count', 'orderby' => 'meta_value_num', "meta_query" => array( array( "key" =...
223,235
<p>I'm a beginner in jQuery-Ajax so please bear with me. My Ajax response does not seem to load but my changes are being saved. but gives me this error on admin-ajax.php "call_user_func() expects parameter 1 to be a valid callback, function '_update_post_ter_count' not found or invalid function name" Here is my functio...
[ { "answer_id": 223278, "author": "Chetan", "author_id": 49618, "author_profile": "https://wordpress.stackexchange.com/users/49618", "pm_score": 0, "selected": false, "text": "<p>You can use meta query see below link it will help you.</p>\n\n<p><a href=\"https://make.wordpress.org/core/20...
2016/04/10
[ "https://wordpress.stackexchange.com/questions/223235", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92111/" ]
I'm a beginner in jQuery-Ajax so please bear with me. My Ajax response does not seem to load but my changes are being saved. but gives me this error on admin-ajax.php "call\_user\_func() expects parameter 1 to be a valid callback, function '\_update\_post\_ter\_count' not found or invalid function name" Here is my func...
You can try this by using meta query to filter results and then adding orderby to order results. Below arguments should work ``` $args = array( 'post_type' => array('post', 'video'), 'meta_key' => 'pp_like_count', 'orderby' => 'meta_value_num', "meta_query" => array( array( "key" =...
223,273
<p>I have a plugin and a custom post type class like this.</p> <p>I want to override one its function in my child theme. </p> <pre><code>class Inspiry_Property_Post_Type { /** * Register Property Post Type * @since 1.0.0 */ public function register_property_post_type() { $labels = array( 'name' ...
[ { "answer_id": 223274, "author": "darrinb", "author_id": 6304, "author_profile": "https://wordpress.stackexchange.com/users/6304", "pm_score": 0, "selected": false, "text": "<p>Depending on how the main class is set up, you can create a child class of the parent class. Something like:</...
2016/04/10
[ "https://wordpress.stackexchange.com/questions/223273", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/90826/" ]
I have a plugin and a custom post type class like this. I want to override one its function in my child theme. ``` class Inspiry_Property_Post_Type { /** * Register Property Post Type * @since 1.0.0 */ public function register_property_post_type() { $labels = array( 'name' => _x( 'Pro...
In general you can not override functions or methods in PHP. Code can be written to support such things, but it needs to be planned in advance, and your snippet is not big enough to be able to decide if it is possible or not in your case. The good thing, is that you do not need to override any function at all as the o...
223,325
<p>After switching to a different wordpress theme, Google started adding a sitename to ALL page titles in the search results. </p> <p>E.g.:</p> <blockquote> <p>"Page title - Sitename" </p> </blockquote> <p>Even when leaving the sitename area blank, Google still adds the homepage title next to every single page. Th...
[ { "answer_id": 223346, "author": "Monkey Puzzle", "author_id": 48568, "author_profile": "https://wordpress.stackexchange.com/users/48568", "pm_score": 1, "selected": false, "text": "<p>In your header.php you may need to replace:</p>\n\n<pre><code>&lt;title&gt;&lt;?php whatever code you f...
2016/04/11
[ "https://wordpress.stackexchange.com/questions/223325", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92164/" ]
After switching to a different wordpress theme, Google started adding a sitename to ALL page titles in the search results. E.g.: > > "Page title - Sitename" > > > Even when leaving the sitename area blank, Google still adds the homepage title next to every single page. This only started hapening after I switch...
By default WordPress use `_wp_render_title_tag` to hook `wp_head` ( see [here](https://core.trac.wordpress.org/browser/tags/4.4.2/src/wp-includes/default-filters.php#L223) ) ``` add_action( 'wp_head', '_wp_render_title_tag', 1 ); ``` This function is wrapper of [`wp_get_document_title`](https://developer.wordpress.o...
223,333
<p>In a Twenty Thirteen child theme I append a menu item (a link to <a href="https://wordpress.stackexchange.com/questions/222638/how-to-pass-a-numeric-id-to-a-page-template">/player-number</a> page template, where the number is different for each user and represents her or his id in a game database) using the <a href=...
[ { "answer_id": 223343, "author": "Monkey Puzzle", "author_id": 48568, "author_profile": "https://wordpress.stackexchange.com/users/48568", "pm_score": 0, "selected": false, "text": "<p>The other pages show a 'current menu item' css state: </p>\n\n<pre><code>.nav-menu .current_page_item &...
2016/04/11
[ "https://wordpress.stackexchange.com/questions/223333", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/41372/" ]
In a Twenty Thirteen child theme I append a menu item (a link to [/player-number](https://wordpress.stackexchange.com/questions/222638/how-to-pass-a-numeric-id-to-a-page-template) page template, where the number is different for each user and represents her or his id in a game database) using the [wp\_nav\_menu\_items]...
*@AlexanderFarber*, there are many way to attach attribute class under [`wp_nav_menu`](https://developer.wordpress.org/reference/functions/wp_nav_menu/) link. I agree with *@Sumit*, adding page links in `Appearance > Menu` WordPress take care of `current-menu-item` class or `current_page_item` class. Also, this way is ...
223,357
<p>After testing I realized that Word Press after image upload will make medium and thumbnail sized images of original image <strong>without EXIF/IPTC info</strong></p> <p>I realized it is because GD image library is used on my host, and that is how GD library works by default, strip out all image info.</p> <p>After ...
[ { "answer_id": 223438, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": -1, "selected": false, "text": "<p>You should not assume that image related metadata survives the wordpress image manipulation. As you foun...
2016/04/11
[ "https://wordpress.stackexchange.com/questions/223357", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/25053/" ]
After testing I realized that Word Press after image upload will make medium and thumbnail sized images of original image **without EXIF/IPTC info** I realized it is because GD image library is used on my host, and that is how GD library works by default, strip out all image info. After research I found out that if I...
The problem is that you are using functions from [GD library](http://php.net/manual/es/book.image.php) to manipulate images, not functions from [WordPress Image API (`WP_Image_Editor` class)](https://codex.wordpress.org/Class_Reference/WP_Image_Editor). So, WordPress things doesn't apply to the generated image by your ...
223,473
<p>I am trying to wrap any iframe/embed in my content with some Facebook Instant Articles friendly code (only for that feed). I have it working, but it adds this code to oEmbed output as well which adds in a wrapper that is not needed (since the Facebook Instant Articles already handles oEmbed embeds).</p> <p>Basicall...
[ { "answer_id": 223649, "author": "mikko-lauhakari", "author_id": 52039, "author_profile": "https://wordpress.stackexchange.com/users/52039", "pm_score": 1, "selected": true, "text": "<p>I think you might have to modify the plugin, fork it, if you like the rest of it's functionality.</p>\...
2016/04/12
[ "https://wordpress.stackexchange.com/questions/223473", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/90859/" ]
I am trying to wrap any iframe/embed in my content with some Facebook Instant Articles friendly code (only for that feed). I have it working, but it adds this code to oEmbed output as well which adds in a wrapper that is not needed (since the Facebook Instant Articles already handles oEmbed embeds). Basically, how can...
I think you might have to modify the plugin, fork it, if you like the rest of it's functionality. Then add functionality that when you "favourite" a post/image, instead of adding it to your favourites you get a list which collection you want to add it to. All of these collections could have their own url like www.mysi...
223,491
<p>I have just upgraded to wordpress 4.5 and now my custom logo for the admin doesn't work, the theme which I built uses the following in the theme functions.php:</p> <pre><code>/* change admin logo */ function my_login_logo() { ?&gt; &lt;style type="text/css"&gt; .login h1 a { background-image: url(&lt;?p...
[ { "answer_id": 223492, "author": "WiTon Nope", "author_id": 84518, "author_profile": "https://wordpress.stackexchange.com/users/84518", "pm_score": 2, "selected": true, "text": "<p>I think you have the logo called from the Theme Options try updating your Theme Options alternatively you h...
2016/04/12
[ "https://wordpress.stackexchange.com/questions/223491", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/91532/" ]
I have just upgraded to wordpress 4.5 and now my custom logo for the admin doesn't work, the theme which I built uses the following in the theme functions.php: ``` /* change admin logo */ function my_login_logo() { ?> <style type="text/css"> .login h1 a { background-image: url(<?php echo get_field('logo','...
I think you have the logo called from the Theme Options try updating your Theme Options alternatively you have many plugins that can help you achieve that. Like: <https://wordpress.org/plugins/add-logo-to-admin/> You can always refer to the Wordpress Codes <https://codex.wordpress.org/Customizing_the_Login_Form>
223,536
<p>I am trying to move my javascript to the footer, however when moving jQuery, it breaks a slideshow.</p> <p>I am using the following to load jQuery in the footer:</p> <pre><code>wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', includes_url( '/js/jquery/jquery.js' ), false, NULL, true ); wp_enqueue_sc...
[ { "answer_id": 223543, "author": "Deepak jha", "author_id": 66318, "author_profile": "https://wordpress.stackexchange.com/users/66318", "pm_score": 2, "selected": false, "text": "<p>You are trying to load your inline js script after jQuery just by calling <code>add_action( 'wp_footer', '...
2016/04/13
[ "https://wordpress.stackexchange.com/questions/223536", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/72787/" ]
I am trying to move my javascript to the footer, however when moving jQuery, it breaks a slideshow. I am using the following to load jQuery in the footer: ``` wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', includes_url( '/js/jquery/jquery.js' ), false, NULL, true ); wp_enqueue_script( 'jquery' ); ``...
You are trying to load your inline js script after jQuery just by calling `add_action( 'wp_footer', 'myscript' );` after `wp_enqueue_script( 'jquery' );` But this will not load your `myscript` after `jQuery`. It is not how `wp_footer` and `wp_enqueue_script` works. `wp_footer` has a third argument named "priority". ...
223,552
<p>I used <code>wp_list_table</code> class to create my custom table in the backend. It's working fine. </p> <p>Now, I want to add filters like in the below image. <a href="https://i.stack.imgur.com/Fe89m.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Fe89m.png" alt="enter image description here"></a></p>...
[ { "answer_id": 223846, "author": "bravokeyl", "author_id": 43098, "author_profile": "https://wordpress.stackexchange.com/users/43098", "pm_score": 4, "selected": false, "text": "<p><strong>Code</strong>\n\n\n<pre><code>class Kv_subscribers_list extends WP_List_Table {\n\nfunction __const...
2016/04/13
[ "https://wordpress.stackexchange.com/questions/223552", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/43308/" ]
I used `wp_list_table` class to create my custom table in the backend. It's working fine. Now, I want to add filters like in the below image. [![enter image description here](https://i.stack.imgur.com/Fe89m.png)](https://i.stack.imgur.com/Fe89m.png) Here is my existing code to render admin table with my custom info...
**Code** ``` class Kv_subscribers_list extends WP_List_Table { function __construct(){ global $status, $page; parent::__construct( array( 'singular' => 'notification', 'plural' => 'notifications', 'ajax' => false ) ); } protected functi...
223,604
<p>The wordpress built-in <strong>get_comments()</strong> can easily list out comments base on post type, post meta, post id or comment author id. But I would like to bring them togather, list out recent <strong>received</strong> comments from posts of specific author.</p> <p>My current way can only simply list all co...
[ { "answer_id": 223899, "author": "marikamitsos", "author_id": 17797, "author_profile": "https://wordpress.stackexchange.com/users/17797", "pm_score": 2, "selected": true, "text": "<p>There are two commonly used mapping plugins for WordPress. For the next lines we assume you use the free ...
2016/04/13
[ "https://wordpress.stackexchange.com/questions/223604", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/45717/" ]
The wordpress built-in **get\_comments()** can easily list out comments base on post type, post meta, post id or comment author id. But I would like to bring them togather, list out recent **received** comments from posts of specific author. My current way can only simply list all comments out: ``` <?php ...
There are two commonly used mapping plugins for WordPress. For the next lines we assume you use the free [**WordPress MU Domain Mapping**](https://wordpress.org/plugins/wordpress-mu-domain-mapping/) plugin from the WordPress plugin Repository. From your post I understand you have correctly mapped your domains (you hav...
223,652
<p>I'm trying to remove two of the actions that adds a plugin (sportspress specifically). The actions of this plugins are:</p> <pre><code>add_action('sportspress_before_single_player','sportspress_output_player_details', 15); add_action('sportspress_single_player_content','sportspress_output_player_statistics',20); </...
[ { "answer_id": 223655, "author": "Sumit", "author_id": 32475, "author_profile": "https://wordpress.stackexchange.com/users/32475", "pm_score": 2, "selected": false, "text": "<p>Plugins are loaded in the order of their file names. e.g. plugin with name <code>abc.php</code> loaded first th...
2016/04/14
[ "https://wordpress.stackexchange.com/questions/223652", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92357/" ]
I'm trying to remove two of the actions that adds a plugin (sportspress specifically). The actions of this plugins are: ``` add_action('sportspress_before_single_player','sportspress_output_player_details', 15); add_action('sportspress_single_player_content','sportspress_output_player_statistics',20); ``` I've creat...
There are two things that confuse people when trying to remove a hook: 1. The `remove_action()` or `remove_filter()` calls must take place after the `add_action()` or `add_filter()` calls, *and* before the hook is actually fired. This means that you must know the hook when the calls were added *and* when the hook is f...
223,654
<p>I don't know if this is the correct way to approach this, but here it goes. I'm working on Visual Composer (but could be vanilla WP), and I'm trying to implement a shortcode which generates another bunch of shortcodes. Somewhat a template shortcode.</p> <p>For example:</p> <pre><code>[test title="some title"] </co...
[ { "answer_id": 223661, "author": "doup", "author_id": 91291, "author_profile": "https://wordpress.stackexchange.com/users/91291", "pm_score": 1, "selected": true, "text": "<p>Using <code>do_shortcode</code> within a shortcode does the trick of parsing the inner shortcodes. More informati...
2016/04/14
[ "https://wordpress.stackexchange.com/questions/223654", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/91291/" ]
I don't know if this is the correct way to approach this, but here it goes. I'm working on Visual Composer (but could be vanilla WP), and I'm trying to implement a shortcode which generates another bunch of shortcodes. Somewhat a template shortcode. For example: ``` [test title="some title"] ``` Could be converted ...
Using `do_shortcode` within a shortcode does the trick of parsing the inner shortcodes. More information here: <https://developer.wordpress.org/reference/functions/do_shortcode/>
223,657
<p>I have pages, posts and woocommerce product categories and products in my website. I want to limit wordpress default search query so that it returns the posts, the pages, the product categories but <strong>NOT</strong> individual products. I am using the following code in my <code>functions.php</code> with which I c...
[ { "answer_id": 223681, "author": "Monkey Puzzle", "author_id": 48568, "author_profile": "https://wordpress.stackexchange.com/users/48568", "pm_score": 3, "selected": true, "text": "<p>You may need to include a tax_query for the Woocommerce taxonomy (called 'product_cat'):</p>\n\n<pre><co...
2016/04/14
[ "https://wordpress.stackexchange.com/questions/223657", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81686/" ]
I have pages, posts and woocommerce product categories and products in my website. I want to limit wordpress default search query so that it returns the posts, the pages, the product categories but **NOT** individual products. I am using the following code in my `functions.php` with which I can easily show only posts a...
You may need to include a tax\_query for the Woocommerce taxonomy (called 'product\_cat'): ``` $tax_query = array( array( 'taxonomy' => 'product_cat' ), ); $query->set( 'tax_query', $tax_query ); } return $query; } ``` However, you'll have to ensure that you can return pos...
223,658
<p>I have an image site which based on Wordpress. There are different resolutions below the picture in single post. For example:</p> <p>1024*768 - 1200*900 - 800*600</p> <p>When I click on one of these resolutions the image downloading directly to pc. Also creating these resolutions in wp-content/uploads folder. I wa...
[ { "answer_id": 223681, "author": "Monkey Puzzle", "author_id": 48568, "author_profile": "https://wordpress.stackexchange.com/users/48568", "pm_score": 3, "selected": true, "text": "<p>You may need to include a tax_query for the Woocommerce taxonomy (called 'product_cat'):</p>\n\n<pre><co...
2016/04/14
[ "https://wordpress.stackexchange.com/questions/223658", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92364/" ]
I have an image site which based on Wordpress. There are different resolutions below the picture in single post. For example: 1024\*768 - 1200\*900 - 800\*600 When I click on one of these resolutions the image downloading directly to pc. Also creating these resolutions in wp-content/uploads folder. I want to remove o...
You may need to include a tax\_query for the Woocommerce taxonomy (called 'product\_cat'): ``` $tax_query = array( array( 'taxonomy' => 'product_cat' ), ); $query->set( 'tax_query', $tax_query ); } return $query; } ``` However, you'll have to ensure that you can return pos...
223,684
<p>WP 4.5 introduced the <a href="https://wpsmackdown.com/device-preview-wordpress-customizer/" rel="nofollow noreferrer">Device Preview in the Customizer</a> and it's pretty easy to use. Click one of three icons and see your site at various (<em>predetermined</em>) sizes.</p> <ul> <li>The desktop version will always ...
[ { "answer_id": 224136, "author": "Luis Sanz", "author_id": 81084, "author_profile": "https://wordpress.stackexchange.com/users/81084", "pm_score": 3, "selected": true, "text": "<p>Both the mobile and the tablet dimensions are defined in the admin's <a href=\"https://core.trac.wordpress.o...
2016/04/14
[ "https://wordpress.stackexchange.com/questions/223684", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/84219/" ]
WP 4.5 introduced the [Device Preview in the Customizer](https://wpsmackdown.com/device-preview-wordpress-customizer/) and it's pretty easy to use. Click one of three icons and see your site at various (*predetermined*) sizes. * The desktop version will always fill up 100% of your screen * The tablet version is set to...
Both the mobile and the tablet dimensions are defined in the admin's [themes.css](https://core.trac.wordpress.org/browser/tags/4.5.1/src/wp-admin/css/themes.css#L1579) file. The javascript that runs when the buttons are triggered is just for adding and removing classes and not for dealing with the sizes themselves. So...
223,707
<p>For <strong>multiple</strong> search terms; <code>?s=hello+world</code></p> <p>Wordpress work find <strong>"hello world"</strong> like <code>the_title</code> , <code>the_content</code> posts!</p> <ul> <li><em>And, if our post title <code>Hello Anna</code> wordpress does not get one results!</em></li> </ul> <block...
[ { "answer_id": 223709, "author": "1Bladesforhire", "author_id": 81382, "author_profile": "https://wordpress.stackexchange.com/users/81382", "pm_score": -1, "selected": false, "text": "<p>You are getting into deep water quickly. I would look into SearchWP plugin as they provide LIKE searc...
2016/04/14
[ "https://wordpress.stackexchange.com/questions/223707", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/84842/" ]
For **multiple** search terms; `?s=hello+world` Wordpress work find **"hello world"** like `the_title` , `the_content` posts! * *And, if our post title `Hello Anna` wordpress does not get one results!* > > I want to use all keys: > > > **"hello world"** , **"hello"** , **"world"** > > > **Maybe** `array('hell...
Fixed: Search and result the all keys; ``` <?php $the_keys = preg_split('/\s+/', str_replace('-',' ',get_query_var('s')),-1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); $total_keys = count($the_keys); $the_query = new WP_Query(array('post_type'=>'nothing')); if($total_keys>1)...
223,708
<p>My site is <a href="http://exteriorinteriorsdesign.com/" rel="nofollow">http://exteriorinteriorsdesign.com/</a></p> <p>After Updating wordpress 4.5,it couldn't load my images and articles on Homepage, and dashboard also doesn't show when i move my cursor over there.</p> <p>Any solution?</p>
[ { "answer_id": 223712, "author": "Anthony", "author_id": 24924, "author_profile": "https://wordpress.stackexchange.com/users/24924", "pm_score": 0, "selected": false, "text": "<p>It's likely that it's a PHP error related to your template or a plugin, but you'll need more info to solve it...
2016/04/14
[ "https://wordpress.stackexchange.com/questions/223708", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92389/" ]
My site is <http://exteriorinteriorsdesign.com/> After Updating wordpress 4.5,it couldn't load my images and articles on Homepage, and dashboard also doesn't show when i move my cursor over there. Any solution?
You are using a theme or plugin that uses a jQuery-dependent script with poor syntax. In this screenshot below of the browser console of the page you referenced, the expression should be `... li > a[href*='#']`. Note the missing quotes around the #. [![Console screenshot of your site](https://i.stack.imgur.com/Drl75.p...
223,722
<p>Updating to WordPress 4.5 broke my theme, <a href="http://emulate.themewoot.com/" rel="nofollow">ThemeWoot Emulate</a>. It appears that perhaps a stylesheet is somehow missing. Example symptoms:</p> <ul> <li>The mobile menu is shown by default</li> <li>The top search box is being shown by default</li> <li>The conta...
[ { "answer_id": 223723, "author": "Douglas Ludlow", "author_id": 12062, "author_profile": "https://wordpress.stackexchange.com/users/12062", "pm_score": 3, "selected": false, "text": "<p>It turns out that the ThemeWoot Emulate theme registers and enqueues a <code>common.css</code> file wi...
2016/04/14
[ "https://wordpress.stackexchange.com/questions/223722", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12062/" ]
Updating to WordPress 4.5 broke my theme, [ThemeWoot Emulate](http://emulate.themewoot.com/). It appears that perhaps a stylesheet is somehow missing. Example symptoms: * The mobile menu is shown by default * The top search box is being shown by default * The contact form modal is being shown by default * Various link...
It turns out that the ThemeWoot Emulate theme registers and enqueues a `common.css` file with the key of `common` in it's `themewoot.php` (which is being included in `functions.php`). This key is apparently conflicting with a wp-admin script being registered with the same `common` key, and so, instead of including Em...
223,757
<p>I want to use Wordpress REST API to Login and get user data on android app.</p> <p>I am using wp_users table for user and a custom table for user info .</p> <p>I tried writing my own REST API but i for that i have to make $wpdb accessible outside Wordpress installation. </p> <p>Please provide yours solution havin...
[ { "answer_id": 227127, "author": "Divyanshu Jimmy", "author_id": 92345, "author_profile": "https://wordpress.stackexchange.com/users/92345", "pm_score": 4, "selected": true, "text": "<p>I found the simplest solution using the WP-REST API plugin,first set this in yours environment :</p>\...
2016/04/15
[ "https://wordpress.stackexchange.com/questions/223757", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92345/" ]
I want to use Wordpress REST API to Login and get user data on android app. I am using wp\_users table for user and a custom table for user info . I tried writing my own REST API but i for that i have to make $wpdb accessible outside Wordpress installation. Please provide yours solution having API-KEY , or somethin...
I found the simplest solution using the WP-REST API plugin,first set this in yours environment : 1.) In your themes `functions.php` register API endpoint hooks: ``` add_action( 'rest_api_init', 'register_api_hooks' ); // API custom endpoints for WP-REST API function register_api_hooks() { register_rest_route( ...
223,764
<p>In wp-login.php default is:</p> <pre><code>&lt;meta name="robots" content="noindex,follow"&gt; </code></pre> <p>I want to change it to:</p> <pre><code>&lt;meta name="robots" content="noindex,nofollow"&gt; </code></pre> <p>Is there an easy way or script to change this?</p>
[ { "answer_id": 223772, "author": "prosti", "author_id": 88606, "author_profile": "https://wordpress.stackexchange.com/users/88606", "pm_score": 2, "selected": false, "text": "<p>You can customize your WordPress login page with this action hook.</p>\n\n<pre><code>function f1() {\n echo...
2016/04/15
[ "https://wordpress.stackexchange.com/questions/223764", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/52641/" ]
In wp-login.php default is: ``` <meta name="robots" content="noindex,follow"> ``` I want to change it to: ``` <meta name="robots" content="noindex,nofollow"> ``` Is there an easy way or script to change this?
Extending @prosti answer, WordPress add it using action `login_head` in `wp-login.php` itself. ``` add_action( 'login_head', 'wp_no_robots' ); ``` You can remove this action in theme/plugin and add your own action with custom callback function. Example:- ``` //Keep priority 9 so we can remove WordPress action that...
223,770
<p>Is there any way to add a custom URL to the <code>wp_insert_post</code> function?</p> <pre><code>$my_post = array( 'post_title' =&gt; wp_strip_all_tags( $_POST['post_title'] ), 'post_content' =&gt; $_POST['post_content'], 'post_status' =&gt; 'publish', 'post_author' =&gt; 1, 'post_catego...
[ { "answer_id": 223786, "author": "Caspar", "author_id": 27191, "author_profile": "https://wordpress.stackexchange.com/users/27191", "pm_score": -1, "selected": false, "text": "<p>Seems like you might be looking for this button:</p>\n\n<p><a href=\"https://i.stack.imgur.com/KUkhA.png\" re...
2016/04/15
[ "https://wordpress.stackexchange.com/questions/223770", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92431/" ]
Is there any way to add a custom URL to the `wp_insert_post` function? ``` $my_post = array( 'post_title' => wp_strip_all_tags( $_POST['post_title'] ), 'post_content' => $_POST['post_content'], 'post_status' => 'publish', 'post_author' => 1, 'post_category' => array( 8,39 ) ); wp_insert_po...
You can use `post_name` parameter. ``` $my_post = array( 'post_title' => wp_strip_all_tags( $_POST['post_title'] ), 'post_content' => $_POST['post_content'], 'post_status' => 'publish', 'post_author' => 1, 'post_category' => array( 8,39 ), 'post_name' => 'your-url' ); wp_insert_pos...
223,784
<p>I'm having an issue in WordPress where PHP is dying. I've increased memory, but the PHP process jumps to 100% CPU usage then dies and Apache throws a 500 error.</p> <p>I've tried to get Apache to log something, or PHP/MySQL to log an error but nothing is logged other then a general 500 error.</p> <p>The 500 issue ...
[ { "answer_id": 229708, "author": "Paul Cullen", "author_id": 91132, "author_profile": "https://wordpress.stackexchange.com/users/91132", "pm_score": 0, "selected": false, "text": "<p>The problem was that the CPT was set to hierarchical, switching this to hierarchical: false in the functi...
2016/04/15
[ "https://wordpress.stackexchange.com/questions/223784", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/91132/" ]
I'm having an issue in WordPress where PHP is dying. I've increased memory, but the PHP process jumps to 100% CPU usage then dies and Apache throws a 500 error. I've tried to get Apache to log something, or PHP/MySQL to log an error but nothing is logged other then a general 500 error. The 500 issue is on the list pa...
Try changing **hierarchical: false** in your CPT definition (if your application allows). When CPT's are set to hierarchical: true all posts will be queried in the admin dashboard which can cause memory issues.
223,871
<p>what I did: <li> I installed Wordpress on XAMPP</li> <li> Build a correctly working theme for Wordpress</li> <li> Copied this theme to another folder next to the first one in my Wordpress Themes-folder </li> <li> Made some css Changes and Changed some Header and Footer Tags </li> <li> When I now enable this newly c...
[ { "answer_id": 229708, "author": "Paul Cullen", "author_id": 91132, "author_profile": "https://wordpress.stackexchange.com/users/91132", "pm_score": 0, "selected": false, "text": "<p>The problem was that the CPT was set to hierarchical, switching this to hierarchical: false in the functi...
2016/04/16
[ "https://wordpress.stackexchange.com/questions/223871", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/91239/" ]
what I did: - I installed Wordpress on XAMPP - Build a correctly working theme for Wordpress - Copied this theme to another folder next to the first one in my Wordpress Themes-folder - Made some css Changes and Changed some Header and Footer Tags - When I now enable this newly created theme via WP-Admin panel and ...
Try changing **hierarchical: false** in your CPT definition (if your application allows). When CPT's are set to hierarchical: true all posts will be queried in the admin dashboard which can cause memory issues.
223,885
<p>I'm currently trying to setup a custom nav walker that will use container_class from the menu as a prefix for the class names of the list items and children.</p> <pre><code>$defaults = array( 'menu' =&gt; '', 'menu_class' =&gt; '', 'menu_id' =&gt; '', 'container' =&gt; 'nav', 'container_cl...
[ { "answer_id": 223886, "author": "550", "author_id": 92492, "author_profile": "https://wordpress.stackexchange.com/users/92492", "pm_score": 0, "selected": false, "text": "<p>So far i've tried pulling the value from the nav template. </p>\n\n<p><a href=\"https://github.com/WordPress/Word...
2016/04/16
[ "https://wordpress.stackexchange.com/questions/223885", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92492/" ]
I'm currently trying to setup a custom nav walker that will use container\_class from the menu as a prefix for the class names of the list items and children. ``` $defaults = array( 'menu' => '', 'menu_class' => '', 'menu_id' => '', 'container' => 'nav', 'container_class' => 'nav-primary', 'c...
Go with a custom Walker ``` class Your_Walker_Nav_Menu extends Walker_Nav_Menu { var $container_class; public function __construct($container_class) { $this->container_class = $container_class; } function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { global $wp_qu...
223,897
<p>I'm inserting an image in my theme as follows:</p> <pre><code>the_post_thumbnail('large'); </code></pre> <p>Which results in the following HTML:</p> <pre><code>&lt;img class="wp-post-image" width="660" height="440" sizes="(max-width: 660px) 100vw, 660px" srcset="/uploads/IMG-1024x683.jpg 1024w, /uploads/IMG-300x2...
[ { "answer_id": 223901, "author": "Tung Du", "author_id": 83304, "author_profile": "https://wordpress.stackexchange.com/users/83304", "pm_score": 0, "selected": false, "text": "<p>You're doing right. Just miss one step. I guess you upload image before change the size of large in setting...
2016/04/17
[ "https://wordpress.stackexchange.com/questions/223897", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/80625/" ]
I'm inserting an image in my theme as follows: ``` the_post_thumbnail('large'); ``` Which results in the following HTML: ``` <img class="wp-post-image" width="660" height="440" sizes="(max-width: 660px) 100vw, 660px" srcset="/uploads/IMG-1024x683.jpg 1024w, /uploads/IMG-300x200.jpg 300w, /uploads/IMG-768x512.jpg 76...
WordPress uses `min( intval($content_width), $max_width )` inside `image_constrain_size_for_editor` for `large` image size. As I can see your `$content_width` is set to 660. So, change the `$content_width` in your `functions.php` file to the `1024` or whatever you need. For full-width layout, it's better to remove it....
223,904
<p>Hi I'm fairly new to Shortcode programming and was wondering if it is possible to process the following nested shortcode with different shortcode tags:</p> <pre><code>[review] [title]Sample Review[/title] [image]http://localhost/wordpress/wp-content/uploads/2016/04/picture.jpg[/image] [criteria title="...
[ { "answer_id": 223901, "author": "Tung Du", "author_id": 83304, "author_profile": "https://wordpress.stackexchange.com/users/83304", "pm_score": 0, "selected": false, "text": "<p>You're doing right. Just miss one step. I guess you upload image before change the size of large in setting...
2016/04/17
[ "https://wordpress.stackexchange.com/questions/223904", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92497/" ]
Hi I'm fairly new to Shortcode programming and was wondering if it is possible to process the following nested shortcode with different shortcode tags: ``` [review] [title]Sample Review[/title] [image]http://localhost/wordpress/wp-content/uploads/2016/04/picture.jpg[/image] [criteria title="Criteria 1" sc...
WordPress uses `min( intval($content_width), $max_width )` inside `image_constrain_size_for_editor` for `large` image size. As I can see your `$content_width` is set to 660. So, change the `$content_width` in your `functions.php` file to the `1024` or whatever you need. For full-width layout, it's better to remove it....
223,917
<p>I have a website running the Photocrati theme version 4.9.3 on an AWS t2.micro running Amazon Linux. I use PHP 5.6 with php-fpm and a very recent version of Nginx, compiled with a couple of modules. I have CloudFlare in front of the website, but it accepts connections only from CloudFlare not directly.</p> <p>One W...
[ { "answer_id": 223918, "author": "RRikesh", "author_id": 17305, "author_profile": "https://wordpress.stackexchange.com/users/17305", "pm_score": 0, "selected": false, "text": "<p>I think you messed up the value. <code>home</code> and <code>siteurl</code> values should not end up with a s...
2016/04/17
[ "https://wordpress.stackexchange.com/questions/223917", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92467/" ]
I have a website running the Photocrati theme version 4.9.3 on an AWS t2.micro running Amazon Linux. I use PHP 5.6 with php-fpm and a very recent version of Nginx, compiled with a couple of modules. I have CloudFlare in front of the website, but it accepts connections only from CloudFlare not directly. One Wordpress 4...
If this is done via WP Options API (as opposed to direct SQL query on database) you can use hooks to log it. Something along the lines of (not tested, make sure it works under normal option save first): ``` add_filter( 'pre_update_option_siteurl', function ( $value ) { error_log( wp_debug_backtrace_summary() ); ...
223,929
<p>I have basically worked on this all night and I realize I am quite stuck. </p> <p>I have a sidebar in my wordpress theme that displays the most recent posts. The sidebar looks like this:</p> <p><a href="https://i.stack.imgur.com/yI9ZJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yI9ZJ.png" al...
[ { "answer_id": 223923, "author": "wpclevel", "author_id": 92212, "author_profile": "https://wordpress.stackexchange.com/users/92212", "pm_score": 3, "selected": true, "text": "<p>You can get it easily by making a GET request to: <a href=\"http://yourdomain.com/wp-json/\" rel=\"nofollow\"...
2016/04/17
[ "https://wordpress.stackexchange.com/questions/223929", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82313/" ]
I have basically worked on this all night and I realize I am quite stuck. I have a sidebar in my wordpress theme that displays the most recent posts. The sidebar looks like this: [![enter image description here](https://i.stack.imgur.com/yI9ZJ.png)](https://i.stack.imgur.com/yI9ZJ.png) Below each title I want to di...
You can get it easily by making a GET request to: <http://yourdomain.com/wp-json/>. You will see your site name, description, url and home...
223,975
<p>I'm making a custom post meta search with the pre_get_posts function in my Divi child theme functions.php file. The problem is that the final query gathers not only the results for my custom post field (named 'autor') but other fields like 'post_title' and 'post_post' which I have not included.</p> <p>That's the re...
[ { "answer_id": 223983, "author": "Joel", "author_id": 65652, "author_profile": "https://wordpress.stackexchange.com/users/65652", "pm_score": 0, "selected": false, "text": "<p>The parameter for meta query is meta_key, not just key (according to <a href=\"https://codex.wordpress.org/Class...
2016/04/17
[ "https://wordpress.stackexchange.com/questions/223975", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/65514/" ]
I'm making a custom post meta search with the pre\_get\_posts function in my Divi child theme functions.php file. The problem is that the final query gathers not only the results for my custom post field (named 'autor') but other fields like 'post\_title' and 'post\_post' which I have not included. That's the resultin...
Create a another filter to remove post title and post content remove search terms try this if this helpful for you ``` add_filter( 'posts_search', 'custom_post_search_author_do', 10, 2 ); function custom_post_search_author_do($search, $query ){ if( ! empty($search) && $query->is_main_query() && !i...
223,979
<p>I'm trying to display a custom field value added to custom taxonomy on single custom post type. I have articles post type with custom taxonomy called issue. I used the code from <a href="https://github.com/bainternet/Tax-Meta-Class" rel="nofollow">Tax-Meta-Class</a> to add custom field "publication date" to that ta...
[ { "answer_id": 223981, "author": "P-S", "author_id": 38771, "author_profile": "https://wordpress.stackexchange.com/users/38771", "pm_score": 1, "selected": false, "text": "<p>Possible solutions:</p>\n\n<ol>\n<li><p>Check if there's a <strong>prefix</strong> which you setup for the custom...
2016/04/17
[ "https://wordpress.stackexchange.com/questions/223979", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/73173/" ]
I'm trying to display a custom field value added to custom taxonomy on single custom post type. I have articles post type with custom taxonomy called issue. I used the code from [Tax-Meta-Class](https://github.com/bainternet/Tax-Meta-Class) to add custom field "publication date" to that taxonomy. For each issue I added...
Here what I did & finally problem is solved. To make the code work just use `get_term_meta` and add `true` to be like this: ``` $res .= get_term_meta($t_id,'publication_date',true); ``` I hope this will help any one facing such issue. Also, those who use prefix need to add it before the field name as mentioned ...
224,009
<p>I have one small problem and I can't find answer...I have created custom post type and custom taxonomy, but my custom taxonomy is showing as sub menu under custom pos type, here is <a href="https://i.stack.imgur.com/DMa9Y.png" rel="nofollow noreferrer"> example what I need</a> how can I do this??? here is how my tax...
[ { "answer_id": 223981, "author": "P-S", "author_id": 38771, "author_profile": "https://wordpress.stackexchange.com/users/38771", "pm_score": 1, "selected": false, "text": "<p>Possible solutions:</p>\n\n<ol>\n<li><p>Check if there's a <strong>prefix</strong> which you setup for the custom...
2016/04/18
[ "https://wordpress.stackexchange.com/questions/224009", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/90629/" ]
I have one small problem and I can't find answer...I have created custom post type and custom taxonomy, but my custom taxonomy is showing as sub menu under custom pos type, here is [example what I need](https://i.stack.imgur.com/DMa9Y.png) how can I do this??? here is how my taxonomy and post type is registered: ``` ...
Here what I did & finally problem is solved. To make the code work just use `get_term_meta` and add `true` to be like this: ``` $res .= get_term_meta($t_id,'publication_date',true); ``` I hope this will help any one facing such issue. Also, those who use prefix need to add it before the field name as mentioned ...
224,023
<p>I want to allow my client to change some introductory text on a custom post archive page (eg. <code>archive-unicorn.php</code>), but I can't see how to do this.</p> <p>I guess one way I could do this is would be to create a page template page instead (eg. <code>page-unicorn.php</code>), and use <code>query_posts()<...
[ { "answer_id": 224028, "author": "Max Yudin", "author_id": 11761, "author_profile": "https://wordpress.stackexchange.com/users/11761", "pm_score": 2, "selected": false, "text": "<ol>\n<li><p>You can use <a href=\"https://codex.wordpress.org/Options_API\" rel=\"nofollow\">Options API</a>\...
2016/04/18
[ "https://wordpress.stackexchange.com/questions/224023", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4109/" ]
I want to allow my client to change some introductory text on a custom post archive page (eg. `archive-unicorn.php`), but I can't see how to do this. I guess one way I could do this is would be to create a page template page instead (eg. `page-unicorn.php`), and use `query_posts()` to get when I want on the page inste...
1. You can use [Options API](https://codex.wordpress.org/Options_API) or [Setting API](https://codex.wordpress.org/Settings_API) to store the data in the database. Write a plugin to create a meta box for the introduction text and show that text on the `archive-unicorn.php`. 2. Or you can utilize the `description` param...
224,029
<p>I'm displaying a list of terms that a post is assigned to by using the following:</p> <pre><code>&lt;?php $terms = get_the_terms( $post-&gt;ID , 'winetype' ); $sep = ', '; foreach ( $terms as $term ) { echo $term-&gt;name; echo $sep; } ?&gt; </code></pre> <p>But we would like the output to be in descending a...
[ { "answer_id": 224031, "author": "Robbert", "author_id": 25834, "author_profile": "https://wordpress.stackexchange.com/users/25834", "pm_score": 4, "selected": true, "text": "<p>You could try this:</p>\n\n<pre><code>// Get posts terms\n$terms = wp_get_post_terms( $post-&gt;ID, 'winetype'...
2016/04/18
[ "https://wordpress.stackexchange.com/questions/224029", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34820/" ]
I'm displaying a list of terms that a post is assigned to by using the following: ``` <?php $terms = get_the_terms( $post->ID , 'winetype' ); $sep = ', '; foreach ( $terms as $term ) { echo $term->name; echo $sep; } ?> ``` But we would like the output to be in descending alphabetical order (Z-A), I can't find ...
You could try this: ``` // Get posts terms $terms = wp_get_post_terms( $post->ID, 'winetype', array( 'order' => 'DESC') ); $sep = ', '; foreach ( $terms as $term ) { echo $term->name; echo $sep; } ```
224,035
<p>Checking my error log on the server I continually see the error:</p> <pre><code>PHP Warning: Division by zero in /public_html/wp-content/themes/sass-wordpress-bootstrap-master/image.php on line 95 </code></pre> <p>Here is the code where that error is occurring:</p> <pre><code>$imgmeta = wp_get_attachment_metadat...
[ { "answer_id": 224038, "author": "Bruno Cantuaria", "author_id": 65717, "author_profile": "https://wordpress.stackexchange.com/users/65717", "pm_score": 0, "selected": false, "text": "<p>Even that you're sure that all your images have the 'shutter_speed' declared and more than 0 (althoug...
2016/04/18
[ "https://wordpress.stackexchange.com/questions/224035", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/64789/" ]
Checking my error log on the server I continually see the error: ``` PHP Warning: Division by zero in /public_html/wp-content/themes/sass-wordpress-bootstrap-master/image.php on line 95 ``` Here is the code where that error is occurring: ``` $imgmeta = wp_get_attachment_metadata( $id ); // Con...
shutter speed is one of the exif data wordpress tries to extract from images when uploaded. If the image do not contain the info it will be zero, hence your division by zero error. Somewhere before that code you should check if the image even needs to go there. If it is not a photo then probably not.
224,068
<p>I have this...</p> <pre><code>&lt;?php echo strip_tags (get_the_term_list( $post-&gt;ID, 'school-year-level', ' ',', ')); ?&gt; </code></pre> <p>which nicely unlinks and comma separates a list of terms from a specified custom taxonomy (school-year-level). However the list isn't in the order I want. I've hunted dow...
[ { "answer_id": 224074, "author": "darrinb", "author_id": 6304, "author_profile": "https://wordpress.stackexchange.com/users/6304", "pm_score": 1, "selected": false, "text": "<p>Try this (tested on my dev site):</p>\n\n<pre><code>$taxonomy = 'name-of-your-taxonomy';\n$args = array('orderb...
2016/04/18
[ "https://wordpress.stackexchange.com/questions/224068", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/37346/" ]
I have this... ``` <?php echo strip_tags (get_the_term_list( $post->ID, 'school-year-level', ' ',', ')); ?> ``` which nicely unlinks and comma separates a list of terms from a specified custom taxonomy (school-year-level). However the list isn't in the order I want. I've hunted down this... <http://codex.wordpress.o...
For the sake of performance, you should rather use `get_the_terms()` to get the post terms and then use `usort` to sort the results. `wp_get_object_terms()` are not cached and therefor requires an extra db call per post queried. While at it, also, you would want to pass the complete term object to `get_term_link()`. ...
224,087
<p><strong>I'm currently getting this error in the front-end only (not inside /wp-admin):</strong></p> <pre><code>Warning: mysqli_real_connect(): (HY000/1203): User xxx already has more than 'max_user_connections' active connections in /hermes/.../public_html/myhome/wp-includes/wp-db.php on line 1489 Warning: mysql_co...
[ { "answer_id": 224074, "author": "darrinb", "author_id": 6304, "author_profile": "https://wordpress.stackexchange.com/users/6304", "pm_score": 1, "selected": false, "text": "<p>Try this (tested on my dev site):</p>\n\n<pre><code>$taxonomy = 'name-of-your-taxonomy';\n$args = array('orderb...
2016/04/18
[ "https://wordpress.stackexchange.com/questions/224087", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/89346/" ]
**I'm currently getting this error in the front-end only (not inside /wp-admin):** ``` Warning: mysqli_real_connect(): (HY000/1203): User xxx already has more than 'max_user_connections' active connections in /hermes/.../public_html/myhome/wp-includes/wp-db.php on line 1489 Warning: mysql_connect(): User xxx already ...
For the sake of performance, you should rather use `get_the_terms()` to get the post terms and then use `usort` to sort the results. `wp_get_object_terms()` are not cached and therefor requires an extra db call per post queried. While at it, also, you would want to pass the complete term object to `get_term_link()`. ...
224,091
<p>I have be trying this all day but it is not working how do I set a role for the current user I am inserting with the <code>wp_insert_user()</code> function</p> <pre><code>$userdata = array( 'user_login' =&gt; $username, 'user_email' =&gt; $email, 'user_pass' =&gt; $password, 'user_url' =&gt; $web...
[ { "answer_id": 224093, "author": "prosti", "author_id": 88606, "author_profile": "https://wordpress.stackexchange.com/users/88606", "pm_score": 4, "selected": true, "text": "<pre><code>$WP_array = array (\n 'user_login' =&gt; $username,\n 'user_email' =&gt; $email,\...
2016/04/18
[ "https://wordpress.stackexchange.com/questions/224091", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/86976/" ]
I have be trying this all day but it is not working how do I set a role for the current user I am inserting with the `wp_insert_user()` function ``` $userdata = array( 'user_login' => $username, 'user_email' => $email, 'user_pass' => $password, 'user_url' => $website, 'first_name' => $first_name...
``` $WP_array = array ( 'user_login' => $username, 'user_email' => $email, 'user_pass' => $password, 'user_url' => $website, 'first_name' => $first_name, 'last_name' => $last_name, 'nickname' => $nickname, 'description' ...
224,118
<p>I'm new from wordpress and i want improve security of wordpress multisite by hiding non public resources, eg. wp-admin, wp-config etc.</p> <p>My setting seem to work, but i don't know if this setting can break something (core features, popular plug-in, etc.)</p> <ol> <li>Are my settings good in general way?</li> ...
[ { "answer_id": 227744, "author": "Uncle Iroh", "author_id": 44927, "author_profile": "https://wordpress.stackexchange.com/users/44927", "pm_score": -1, "selected": false, "text": "<p>Are you running your site on cPanel?</p>\n\n<p>If so, explore your control panel and you'll see a few gre...
2016/04/19
[ "https://wordpress.stackexchange.com/questions/224118", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92207/" ]
I'm new from wordpress and i want improve security of wordpress multisite by hiding non public resources, eg. wp-admin, wp-config etc. My setting seem to work, but i don't know if this setting can break something (core features, popular plug-in, etc.) 1. Are my settings good in general way? 2. My settings improve rea...
Using `remove_action()` can be remove unnecessary links for example: ``` remove_action('wp_head', 'rsd_link'); //removes EditURI/RSD (Really Simple Discovery) link. remove_action('wp_head', 'wlwmanifest_link'); //removes wlwmanifest (Windows Live Writer) link. remove_action('wp_head', 'wp_generator'); //removes meta n...
224,159
<p>I have been looking for ways to completely remove the All, Published, and Trash webpages for USERS <strong><em>other than the me, the Administrator</em></strong>.</p> <p>So the scenario for me is: I have registered users (which I would like to assign with the roles of authors, contributors, etc). Now, when they log...
[ { "answer_id": 224166, "author": "darrinb", "author_id": 6304, "author_profile": "https://wordpress.stackexchange.com/users/6304", "pm_score": 2, "selected": false, "text": "<p>Those statuses are turned from <code>get_available_post_statuses()</code>, which in turn gets its values from <...
2016/04/19
[ "https://wordpress.stackexchange.com/questions/224159", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92538/" ]
I have been looking for ways to completely remove the All, Published, and Trash webpages for USERS ***other than the me, the Administrator***. So the scenario for me is: I have registered users (which I would like to assign with the roles of authors, contributors, etc). Now, when they log in to my website and access t...
The `WP_Posts_List_Table` class extends `WP_List_Table` and within the `WP_List_Table::views()` method we have the following dynamic *views* filter: ``` /** * Filter the list of available list table views. * * The dynamic portion of the hook name, `$this->screen->id`, refers * to the ID of the current screen, usua...
224,197
<p>How can I add Bootstrap to the Wordpress TwentySixteen Theme without using a plugin? I've tried linking to the stylesheets and scripts within the header/footer, however the theme seems to override something, and I'm unable to get different Bootstrap elements to work on specific pages. For instance, I've tried to get...
[ { "answer_id": 224235, "author": "Swopnil Dangol", "author_id": 90685, "author_profile": "https://wordpress.stackexchange.com/users/90685", "pm_score": 1, "selected": false, "text": "<p>If you want to link stylesheets and scripts in wordpress,the correct way is to use wp_enqueue_style() ...
2016/04/19
[ "https://wordpress.stackexchange.com/questions/224197", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92655/" ]
How can I add Bootstrap to the Wordpress TwentySixteen Theme without using a plugin? I've tried linking to the stylesheets and scripts within the header/footer, however the theme seems to override something, and I'm unable to get different Bootstrap elements to work on specific pages. For instance, I've tried to get th...
If you want to link stylesheets and scripts in wordpress,the correct way is to use wp\_enqueue\_style() and wp\_enqueue\_scripts() in your functions.php file Try this in your functions.php file ``` wp_enqueue_style('bootstrap-css',get_template_directory_uri().'/bootstrap/css/bootstrap.min.css'); wp_enqueue_script('jq...
224,219
<p>I'll be brief and hope I can explain my scenario correctly. Here's my scenario. The jQuery slider plugin has an anonymous callback method. I would like to give the Admin the ability to create a function for that callback method. So from the plugin's add/edit pages the admin has a textarea to input the jQuery code. N...
[ { "answer_id": 224208, "author": "darrinb", "author_id": 6304, "author_profile": "https://wordpress.stackexchange.com/users/6304", "pm_score": 3, "selected": false, "text": "<p>You can change the name of your plugin, you just can't change the url slug of your plugin. Meaning, if you ini...
2016/04/20
[ "https://wordpress.stackexchange.com/questions/224219", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92661/" ]
I'll be brief and hope I can explain my scenario correctly. Here's my scenario. The jQuery slider plugin has an anonymous callback method. I would like to give the Admin the ability to create a function for that callback method. So from the plugin's add/edit pages the admin has a textarea to input the jQuery code. Now ...
You can change the name of your plugin, you just can't change the url slug of your plugin. Meaning, if you initially added a plugin to the repo and it was called "Posts With Ad Thumbnails" your url would be: `https://wordpress.org/plugins/posts-with-ad-thumbnails/` After uploading your plugin, if you decide to change ...
224,257
<pre><code>$new_post = array( 'post_title' =&gt; $title, 'post_content' =&gt; $description, 'post_category' =&gt; array($_POST['cat']), // Usable for custom taxonomies too 'tags_input' =&gt; array...
[ { "answer_id": 224267, "author": "TheDeadMedic", "author_id": 1685, "author_profile": "https://wordpress.stackexchange.com/users/1685", "pm_score": 3, "selected": false, "text": "<p>Check the <a href=\"https://developer.wordpress.org/reference/functions/wp_insert_post/\" rel=\"noreferrer...
2016/04/20
[ "https://wordpress.stackexchange.com/questions/224257", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92398/" ]
``` $new_post = array( 'post_title' => $title, 'post_content' => $description, 'post_category' => array($_POST['cat']), // Usable for custom taxonomies too 'tags_input' => array($tags), ...
You'll have to do this in two steps. First, you will create a post in the draft mode, using wp\_insert\_post(). The wp\_insert\_post itself will return to you the ID of the inserted post: ``` <?php $new_post = array( 'post_title' => 'Draft title', 'post_status' => 'draft' 'post_type' => 'my_cust...
224,278
<p>I am in trouble. I have a travel site...I have created a page where users can write a form to insert their houses.</p> <p>The houses are of course a custom post type.</p> <p>This is a piece of my code:</p> <pre><code>... some validation here if ($idarticolo = wp_insert_post($post)) { //lingua global $po...
[ { "answer_id": 224280, "author": "RiaanP", "author_id": 66345, "author_profile": "https://wordpress.stackexchange.com/users/66345", "pm_score": 3, "selected": true, "text": "<p>Apparently Polylang has an undocumented pll_save_post API method. See here: <a href=\"https://wordpress.org/sup...
2016/04/20
[ "https://wordpress.stackexchange.com/questions/224278", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92701/" ]
I am in trouble. I have a travel site...I have created a page where users can write a form to insert their houses. The houses are of course a custom post type. This is a piece of my code: ``` ... some validation here if ($idarticolo = wp_insert_post($post)) { //lingua global $polylang; $lang = pll_curr...
Apparently Polylang has an undocumented pll\_save\_post API method. See here: <https://wordpress.org/support/topic/programmatically-set-post-language-and-translations>
224,288
<p>I want to add bootstrap img-responsive and img-rounded classes to avatar image when displaying one. But for some reason the class is not displayed when using <code>get_avatar</code>.</p> <p>By WordPress codex there is an attributes list that you can use in <code>get_avatar</code> to alter the function but my doesn'...
[ { "answer_id": 261318, "author": "gavsiu", "author_id": 7466, "author_profile": "https://wordpress.stackexchange.com/users/7466", "pm_score": 3, "selected": false, "text": "<p>I had this problem, too. Here's the solution for version 4.7.3 if anyone comes across this.</p>\n\n<pre><code>ge...
2016/04/20
[ "https://wordpress.stackexchange.com/questions/224288", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/21135/" ]
I want to add bootstrap img-responsive and img-rounded classes to avatar image when displaying one. But for some reason the class is not displayed when using `get_avatar`. By WordPress codex there is an attributes list that you can use in `get_avatar` to alter the function but my doesn't pickup class array list. Here...
I had this problem, too. Here's the solution for version 4.7.3 if anyone comes across this. ``` get_avatar( $id_or_email = get_the_author_meta( 'user_email' ), $size = '60', $default, $alt, $args = array( 'class' => array( 'd-block', 'mx-auto' ) ) ); ``` or shorter version ``` get_avatar( get_the_author_meta( 'user...
224,296
<p>Is there a way to remove all query arg parameter in the URL added via <code>add_query_arg();</code> without knowing the query key available for removal?</p> <p>I'm looking for this kind of function <code>remove_query_arg_all();</code> currently I'm removing the query_arg via preg_match REQUEST_URI, but not sure if ...
[ { "answer_id": 224300, "author": "gmazzap", "author_id": 35541, "author_profile": "https://wordpress.stackexchange.com/users/35541", "pm_score": 4, "selected": true, "text": "<p>You can explode URL by <code>?</code> and take the first part:</p>\n\n<pre><code>$url = explode( '?', esc_url_...
2016/04/20
[ "https://wordpress.stackexchange.com/questions/224296", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10997/" ]
Is there a way to remove all query arg parameter in the URL added via `add_query_arg();` without knowing the query key available for removal? I'm looking for this kind of function `remove_query_arg_all();` currently I'm removing the query\_arg via preg\_match REQUEST\_URI, but not sure if it will cause any problem in ...
You can explode URL by `?` and take the first part: ``` $url = explode( '?', esc_url_raw( add_query_arg( array() ) ) ); $no_query_args = $url[0]; ```
224,312
<p><strong>Hello,</strong></p> <p>I have a 'Custom Post Type' with 8 taxonomies and I'm pretending display a list with only 6 taxonomies and the no empties terms of each one and hide 2 taxonomies.</p> <p>My current code displays all taxonomies with all terms hiding the empties one but I can not get how to hide the tw...
[ { "answer_id": 224315, "author": "darrinb", "author_id": 6304, "author_profile": "https://wordpress.stackexchange.com/users/6304", "pm_score": 2, "selected": false, "text": "<p>Try this: </p>\n\n<pre><code>&lt;?php\n$object = 'post';\n$output = 'objects';\n$taxonomies = get_object_taxo...
2016/04/20
[ "https://wordpress.stackexchange.com/questions/224312", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/65640/" ]
**Hello,** I have a 'Custom Post Type' with 8 taxonomies and I'm pretending display a list with only 6 taxonomies and the no empties terms of each one and hide 2 taxonomies. My current code displays all taxonomies with all terms hiding the empties one but I can not get how to hide the two taxonomies I want. This is ...
**@darrinb** I have solved the problem. Your code helped me a lot although had a error. :) The error was getting the 'terms': ``` $terms = get_terms( array( 'taxonomy' => $taxonomy->name, 'hide_empty' => true, ) ); ``` Following the [codex](https://developer.wordpress.org/reference/...
224,332
<p>I'm trying to output all of the fields in the json result but seem to be using the object incorrectly. I want to add author meta fields to the post endpoint.</p> <p>This doesn't work</p> <pre><code> function slug_show_author_meta( $object, $field_name, $request ) { return get_the_author_meta( $object[ 'i...
[ { "answer_id": 224336, "author": "wpclevel", "author_id": 92212, "author_profile": "https://wordpress.stackexchange.com/users/92212", "pm_score": 3, "selected": true, "text": "<p>This should work:\n</p>\n\n<pre><code>function wpse_20160421_get_author_meta($object, $field_name, $request) ...
2016/04/21
[ "https://wordpress.stackexchange.com/questions/224332", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/19251/" ]
I'm trying to output all of the fields in the json result but seem to be using the object incorrectly. I want to add author meta fields to the post endpoint. This doesn't work ``` function slug_show_author_meta( $object, $field_name, $request ) { return get_the_author_meta( $object[ 'id' ], $field_name ); ...
This should work: ``` function wpse_20160421_get_author_meta($object, $field_name, $request) { $user_data = get_userdata($object['author']); // get user data from author ID. $array_data = (array)($user_data->data); // object to array conversion. $array_data['first_name'] = get_user_meta($object['author'...
224,347
<p>I connect a lot of my posts to my new ones, and that is probably why I keep getting self pingbacks. Besides a plugin, is there a script I can use to get rid of this? </p>
[ { "answer_id": 224350, "author": "Sumeet Gohel", "author_id": 92729, "author_profile": "https://wordpress.stackexchange.com/users/92729", "pm_score": 3, "selected": true, "text": "<p>You could try this by putting code in functions.php in your theme.</p>\n\n<pre><code>function no_self_pin...
2016/04/21
[ "https://wordpress.stackexchange.com/questions/224347", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/68815/" ]
I connect a lot of my posts to my new ones, and that is probably why I keep getting self pingbacks. Besides a plugin, is there a script I can use to get rid of this?
You could try this by putting code in functions.php in your theme. ``` function no_self_ping( &$links ) { $home = get_option( 'home' ); foreach ( $links as $l => $link ) if ( 0 === strpos( $link, $home ) ) unset($links[$l]); } add_action( 'pre_ping', 'no_self_ping' ); ``` Hope this helpful to you.
224,360
<p>How to i foreach the post title like below. this is what i want below</p> <pre><code>function get_all_post_for_search() { return array ( array( 'name' =&gt; "Hello Project", 'thumb' =&gt; '/wp-content/uploads/2016/03/photo-1442473483905-95eb436675f1.jpeg', 'desc' =&gt; 'Lorem ipsum...
[ { "answer_id": 224365, "author": "Sumit", "author_id": 32475, "author_profile": "https://wordpress.stackexchange.com/users/32475", "pm_score": 1, "selected": false, "text": "<p>Your code has many errors:-</p>\n\n<ul>\n<li><code>$thumbs</code> isn't used anywhere.</li>\n<li><code>$img_url...
2016/04/21
[ "https://wordpress.stackexchange.com/questions/224360", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/85768/" ]
How to i foreach the post title like below. this is what i want below ``` function get_all_post_for_search() { return array ( array( 'name' => "Hello Project", 'thumb' => '/wp-content/uploads/2016/03/photo-1442473483905-95eb436675f1.jpeg', 'desc' => 'Lorem ipsum dolor sit amet, consec...
working code ``` function list_post_data(){ $args="SELECT * FROM wp_posts WHERE wp_posts.`post_type` = 'post' AND wp_posts.`post_status` = 'publish'"; $args = array( 'post_type' => 'post' ); $loop = new WP_Query( $args ); $array = array(); while ( $loop->have_posts() ) : $l...
224,371
<p>I have a CPT called 'experts', that has been created in a theme I bought, and I can't find out where nor where to change it. I need to change a parameter to 'with_front' => false Because my general permaling structure goes with /blog and I do'nt want experts to be in /blog/experts. Is there a way I could do that a...
[ { "answer_id": 224376, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 4, "selected": true, "text": "<p>You could try the newly <a href=\"https://github.com/WordPress/WordPress/blob/a47fa4f1970996a2aa041ea53a37c491...
2016/04/21
[ "https://wordpress.stackexchange.com/questions/224371", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92741/" ]
I have a CPT called 'experts', that has been created in a theme I bought, and I can't find out where nor where to change it. I need to change a parameter to 'with\_front' => false Because my general permaling structure goes with /blog and I do'nt want experts to be in /blog/experts. Is there a way I could do that add...
You could try the newly [`register_post_type_args`](https://github.com/WordPress/WordPress/blob/a47fa4f1970996a2aa041ea53a37c4918065cc4b/wp-includes/post.php#L1009-L1018) filter to adjust it. Here's an untested example: ``` /** * Set 'with_front' to false for the 'experts' post type. */ add_filter( 'register_post_...
224,399
<p>I'm using <code>Root.io</code>'s <code>Trellis</code> workflow. </p> <p>I've encountered an error wherein I couldn't establish a connection via <code>ansible-playbook</code>.</p> <ol> <li><p>When I run <code>ansible-playbook server.yml -e env=staging</code> it throws me an error that the ssh connection cannot be ...
[ { "answer_id": 224401, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 1, "selected": false, "text": "<p>You probably have not added your <strong>public</strong> key to the <code>authorized_keys</code> file <em>inside</...
2016/04/21
[ "https://wordpress.stackexchange.com/questions/224399", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/83285/" ]
I'm using `Root.io`'s `Trellis` workflow. I've encountered an error wherein I couldn't establish a connection via `ansible-playbook`. 1. When I run `ansible-playbook server.yml -e env=staging` it throws me an error that the ssh connection cannot be established so I checked my `users.yml` file and saw a problem under...
I've also posted this question on [discourse](https://discourse.roots.io/t/failure-to-establish-connection-when-provisioning-via-ansible-playbook-server-yml/6518?u=jzarzoso) and [@fullyint](https://discourse.roots.io/t/failure-to-establish-connection-when-provisioning-via-ansible-playbook-server-yml/6518/3?u=jzarzoso) ...
224,416
<p>So there is the following scenario.</p> <p>I add an action to clean logs from the database:</p> <pre><code>add_action( 'myplugin_clean_logs', array( 'MyPlugin_Logs', 'clean_logs' ) ); </code></pre> <p>Now I want to run this action periodically:</p> <pre><code>wp_schedule_event( current_time( 'timestamp' ), 'dail...
[ { "answer_id": 224425, "author": "Caspar", "author_id": 27191, "author_profile": "https://wordpress.stackexchange.com/users/27191", "pm_score": 4, "selected": false, "text": "<p>The cool thing is a filter is the same as an action, only it returns a value, so just set it up as a filter in...
2016/04/21
[ "https://wordpress.stackexchange.com/questions/224416", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/65557/" ]
So there is the following scenario. I add an action to clean logs from the database: ``` add_action( 'myplugin_clean_logs', array( 'MyPlugin_Logs', 'clean_logs' ) ); ``` Now I want to run this action periodically: ``` wp_schedule_event( current_time( 'timestamp' ), 'daily', 'myplugin_clean_logs' ); ``` and execu...
The cool thing is a filter is the same as an action, only it returns a value, so just set it up as a filter instead: `add_filter( 'myplugin_clean_logs', array( 'MyPlugin_Logs', 'clean_logs' ) );` Then something like: ``` $affected_rows = ''; $affected_rows = apply_filters( 'myplugin_clean_logs', $affected_rows ); `...
224,467
<p>This is my first go at making my own shortcode.</p> <p><strong>What I am trying to do</strong></p> <p>I have 11 different outputs for star ratings I want to be able to use in posts. I want to wrap it all into one shortcode, and be able to call the specific rating I want. I imagine something like this:</p> <p>[sta...
[ { "answer_id": 224425, "author": "Caspar", "author_id": 27191, "author_profile": "https://wordpress.stackexchange.com/users/27191", "pm_score": 4, "selected": false, "text": "<p>The cool thing is a filter is the same as an action, only it returns a value, so just set it up as a filter in...
2016/04/22
[ "https://wordpress.stackexchange.com/questions/224467", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/90803/" ]
This is my first go at making my own shortcode. **What I am trying to do** I have 11 different outputs for star ratings I want to be able to use in posts. I want to wrap it all into one shortcode, and be able to call the specific rating I want. I imagine something like this: [star\_rating grade="3"] That would prod...
The cool thing is a filter is the same as an action, only it returns a value, so just set it up as a filter instead: `add_filter( 'myplugin_clean_logs', array( 'MyPlugin_Logs', 'clean_logs' ) );` Then something like: ``` $affected_rows = ''; $affected_rows = apply_filters( 'myplugin_clean_logs', $affected_rows ); `...
224,480
<p>I am working on a site where the page titles are generated dynamically from external data sources. So obviously, Yoast SEO/WordPress SEO doesn´t know anything about the correct title, description, image etc. in the head when it outputs OpenGraph tags and more.</p> <p>That should be no problem so far, as WordPress S...
[ { "answer_id": 224481, "author": "Z. Zlatev", "author_id": 4192, "author_profile": "https://wordpress.stackexchange.com/users/4192", "pm_score": 2, "selected": false, "text": "<p>Most obvious reason could be the fact <code>wpseo_title</code> filter is firing before you have saved your ti...
2016/04/22
[ "https://wordpress.stackexchange.com/questions/224480", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/65455/" ]
I am working on a site where the page titles are generated dynamically from external data sources. So obviously, Yoast SEO/WordPress SEO doesn´t know anything about the correct title, description, image etc. in the head when it outputs OpenGraph tags and more. That should be no problem so far, as WordPress SEO support...
Most obvious reason could be the fact `wpseo_title` filter is firing before you have saved your title. Try moving `title_storage()` call on a earlier stage like. The `wp` action should be a good candidate.
224,485
<p>So there is the following case.</p> <p>I need to display a name inside of <code>admin_notices</code>.</p> <pre><code>class MyPlugin_Admin { public static function render_admin_notice() { echo $name . ' has been upgraded.'; } } add_action( 'admin_notices', array( 'MyPlugin_Admin', 'render_admin_not...
[ { "answer_id": 224501, "author": "TheDeadMedic", "author_id": 1685, "author_profile": "https://wordpress.stackexchange.com/users/1685", "pm_score": 5, "selected": true, "text": "<p>I think a better implementation would be a \"message\" class e.g.:</p>\n\n<pre><code>class WPSE_224485_Mess...
2016/04/22
[ "https://wordpress.stackexchange.com/questions/224485", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/65557/" ]
So there is the following case. I need to display a name inside of `admin_notices`. ``` class MyPlugin_Admin { public static function render_admin_notice() { echo $name . ' has been upgraded.'; } } add_action( 'admin_notices', array( 'MyPlugin_Admin', 'render_admin_notice' ) ); ``` How to populate ...
I think a better implementation would be a "message" class e.g.: ``` class WPSE_224485_Message { private $_message; function __construct( $message ) { $this->_message = $message; add_action( 'admin_notices', array( $this, 'render' ) ); } function render() { printf( '<div clas...
224,487
<p>I've created a custom post type and would like to send those posts to FB Instant Articles and Apple News via a RSS feed. I've created a custom RSS feed and need to know what's the best way to make that feed password-protected. The CPT is called limitedrun. The feed URL is domain.com/?feed=ltdrun and the RSS template...
[ { "answer_id": 224501, "author": "TheDeadMedic", "author_id": 1685, "author_profile": "https://wordpress.stackexchange.com/users/1685", "pm_score": 5, "selected": true, "text": "<p>I think a better implementation would be a \"message\" class e.g.:</p>\n\n<pre><code>class WPSE_224485_Mess...
2016/04/22
[ "https://wordpress.stackexchange.com/questions/224487", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8049/" ]
I've created a custom post type and would like to send those posts to FB Instant Articles and Apple News via a RSS feed. I've created a custom RSS feed and need to know what's the best way to make that feed password-protected. The CPT is called limitedrun. The feed URL is domain.com/?feed=ltdrun and the RSS template is...
I think a better implementation would be a "message" class e.g.: ``` class WPSE_224485_Message { private $_message; function __construct( $message ) { $this->_message = $message; add_action( 'admin_notices', array( $this, 'render' ) ); } function render() { printf( '<div clas...
224,528
<p>I've been using a CPT named "session" that has some date fields. Those date fields are stored via the CMB2 plugin with something like this :</p> <pre><code>$cmb-&gt;add_field( array( 'name' =&gt; __('Begin :', 'cmb2'), 'id' =&gt; $prefix . 'session_datebegin', 'desc' =&gt; __( 'Beginning date of the ses...
[ { "answer_id": 224529, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 0, "selected": false, "text": "<p>In a nutshell this is a poor format to store date.</p>\n\n<p>You get results you get because 05 &lt; 20 &lt; 22 in ...
2016/04/22
[ "https://wordpress.stackexchange.com/questions/224528", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92582/" ]
I've been using a CPT named "session" that has some date fields. Those date fields are stored via the CMB2 plugin with something like this : ``` $cmb->add_field( array( 'name' => __('Begin :', 'cmb2'), 'id' => $prefix . 'session_datebegin', 'desc' => __( 'Beginning date of the session', 'cmb2' ), 'type...
For those who experienced the same problem, I finally found a way to do the sort. First I created an extra CMB like this : ``` $cmb->add_field( array( 'id' => $prefix . 'session_gooddatebegin', 'type' => 'hidden', ) ); ``` Then I created an action using `save_post`. If the CPT "session" is being ...
224,536
<p>I know that I can use the <code>jpeg_quality</code> filter like this:</p> <p><code>add_filter('jpeg_quality', function($arg){return 75;});</code></p> <p>This will reduce the image quality of the images generated during the upload process such as the <em>thumbnail</em>, <em>medium</em> and <em>large</em> image size...
[ { "answer_id": 224539, "author": "Web-Entwickler", "author_id": 92649, "author_profile": "https://wordpress.stackexchange.com/users/92649", "pm_score": 0, "selected": false, "text": "<p>This answer could help you:\n<a href=\"https://wordpress.stackexchange.com/a/69287/92649\">https://wor...
2016/04/22
[ "https://wordpress.stackexchange.com/questions/224536", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/57849/" ]
I know that I can use the `jpeg_quality` filter like this: `add_filter('jpeg_quality', function($arg){return 75;});` This will reduce the image quality of the images generated during the upload process such as the *thumbnail*, *medium* and *large* image sizes, however the **original** image is still at the original q...
In general I wouldn't recommend modifying the original uploaded image files, just in case we might need to re-generate intermediate sizes. *But let's see if it's possible :-)* We can in general let WordPress choose the image editor, that depends on modules like *GD* or *Imagick*, through: ``` $editor = wp_get_image_...
224,540
<p>I currently have a dive set up which I would like to display different bits of information when the user is logged in and has a specific role. </p> <p>I have three roles 'administrator' 'adoption-agency' and 'shop-manager' which I would like to display a link to the admin area. Then I have a role named 'customer' w...
[ { "answer_id": 224554, "author": "Caspar", "author_id": 27191, "author_profile": "https://wordpress.stackexchange.com/users/27191", "pm_score": 1, "selected": false, "text": "<p>Your problem is that <code>current_user_can()</code> takes a <em>capability</em> not a user role. So, to check...
2016/04/22
[ "https://wordpress.stackexchange.com/questions/224540", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/67512/" ]
I currently have a dive set up which I would like to display different bits of information when the user is logged in and has a specific role. I have three roles 'administrator' 'adoption-agency' and 'shop-manager' which I would like to display a link to the admin area. Then I have a role named 'customer' which I wou...
Your problem is that `current_user_can()` takes a *capability* not a user role. So, to check for an administrator, for example, you might use: ``` if ( current_user_can( 'manage_options' ) ) { ... } ``` because ordinarily only admins can manage options. You'd have to tie your custom user roles to capabilities that ...
224,578
<p>I'm running some template files outside of the actual theme and I am displaying some posts on this templates. Everything worked absolutely fine but some days ago (maybe the update to 4.5) the default settings of WordPress started to override my <code>posts_per_page=-1</code> and I have no clue why this is starting. ...
[ { "answer_id": 224596, "author": "Steve", "author_id": 92874, "author_profile": "https://wordpress.stackexchange.com/users/92874", "pm_score": 1, "selected": true, "text": "<p>I found the problem. Here is the solution in case someone stumbles upon a similar problem.</p>\n\n<p>I had a fil...
2016/04/23
[ "https://wordpress.stackexchange.com/questions/224578", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92874/" ]
I'm running some template files outside of the actual theme and I am displaying some posts on this templates. Everything worked absolutely fine but some days ago (maybe the update to 4.5) the default settings of WordPress started to override my `posts_per_page=-1` and I have no clue why this is starting. (No new plugin...
I found the problem. Here is the solution in case someone stumbles upon a similar problem. I had a filter in my functions.php that limited the showed posts on several custom taxonomies and the default value was set in the else statement ``` // Customizing posts per page on zitate archive function limit_posts_per_ar...
224,592
<p>I see the following code a lot in index.php files. I understand that <code>is_front_page()</code> returns true when viewing the Site Front Page (whether displaying the blog posts index or a static page), while <code>is_home()</code> returns true when viewing the Blog Posts Index (whether displayed on the front page ...
[ { "answer_id": 224594, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 2, "selected": false, "text": "<p>I am not sure about \"popular\", it doesn't seem so to me (but then I don't look at that many themes).</p>\n\n<p>Yo...
2016/04/23
[ "https://wordpress.stackexchange.com/questions/224592", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81978/" ]
I see the following code a lot in index.php files. I understand that `is_front_page()` returns true when viewing the Site Front Page (whether displaying the blog posts index or a static page), while `is_home()` returns true when viewing the Blog Posts Index (whether displayed on the front page or on a static page). I a...
This will display the title of the **page** when a static page is set to show posts. **E.g.** I show posts on my homepage... It'll do nothing. If I, say, show posts on page titled **News**... It'll show **News** in H1. This is used so that the title of the page is shown, whenever posts are shown on a page, but noth...
224,632
<p>I create a widget for a custom post type that will display a list of post in the widget area. it works fine, i can select multiple posts and save the widget but i can not get it to display on the frontend. <strong>UPDATE</strong> so basically what i'm trying to achieve is list all the posts in the widget area with a...
[ { "answer_id": 224649, "author": "Z. Zlatev", "author_id": 4192, "author_profile": "https://wordpress.stackexchange.com/users/4192", "pm_score": 2, "selected": true, "text": "<p>Without actually knowing what you're trying to achieve I see the following problems:</p>\n\n<ul>\n<li><code>$p...
2016/04/24
[ "https://wordpress.stackexchange.com/questions/224632", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/28580/" ]
I create a widget for a custom post type that will display a list of post in the widget area. it works fine, i can select multiple posts and save the widget but i can not get it to display on the frontend. **UPDATE** so basically what i'm trying to achieve is list all the posts in the widget area with a checkbox (works...
Without actually knowing what you're trying to achieve I see the following problems: * `$post` variable is not defined in your `widget()` method. Try setting it using `$post = get_post( get_the_ID() )` for instance. * By the time you call `foreach ($posts as $post) { ... }` `$posts` variable is also not set. You need ...
224,633
<p>I want to add numbering to each image when I insert them into the post. For example if I insert 3 images into a post, there will be: </p> <ol> <li><p>Image 1 </p></li> <li><p>Image 2</p></li> <li><p>Image 3</p></li> </ol> <p>I looked through the WordPress documentation, but I can't find which hook is triggered whe...
[ { "answer_id": 224635, "author": "jdm2112", "author_id": 45202, "author_profile": "https://wordpress.stackexchange.com/users/45202", "pm_score": 4, "selected": true, "text": "<p>The <code>add_attachment</code> action is fired when the <code>wp_insert_attachment()</code> function is calle...
2016/04/24
[ "https://wordpress.stackexchange.com/questions/224633", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/50610/" ]
I want to add numbering to each image when I insert them into the post. For example if I insert 3 images into a post, there will be: 1. Image 1 2. Image 2 3. Image 3 I looked through the WordPress documentation, but I can't find which hook is triggered when inserting images into a post.
The `add_attachment` action is fired when the `wp_insert_attachment()` function is called to add an item to the media library. Images are added to posts after going into the media library first. Even when adding via the post editor, items are added to the library with `wp_insert_attachment()` then to the post. ``` add...
224,645
<p>I tried to filter only the text in <code>get_the_content</code> for my home page, but its including my shortcode also, because in that page first row google map 2nd row text box i am using visual composer page builder.</p> <p><strong>My code</strong></p> <pre><code>$content = get_the_content(); $content = apply_fi...
[ { "answer_id": 224650, "author": "Tim Malone", "author_id": 46066, "author_profile": "https://wordpress.stackexchange.com/users/46066", "pm_score": 1, "selected": false, "text": "<p>Based on your comment clarifying what you want to achieve, it appears you want to display the first 60 cha...
2016/04/24
[ "https://wordpress.stackexchange.com/questions/224645", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/85768/" ]
I tried to filter only the text in `get_the_content` for my home page, but its including my shortcode also, because in that page first row google map 2nd row text box i am using visual composer page builder. **My code** ``` $content = get_the_content(); $content = apply_filters('the_content', substr(get_the_content()...
Based on your comment clarifying what you want to achieve, it appears you want to display the first 60 characters of your post *not including any shortcodes*. To do this you can use the `strip_shortcodes()` function. Rewritten with that, your code will look like this: ``` $content = strip_shortcodes(get_the_content()...
224,661
<p>Why is there a constant notice,</p> <blockquote> <p>JQMIGRATE: Migrate is installed, version 1.4.0</p> </blockquote> <p>that points to <code>load-scripts.php</code> in my console when I updated my theme to WordPress 4.5, and how can it be removed?</p> <p>It's not an error, but it's always present in my console, and ...
[ { "answer_id": 224666, "author": "Andy", "author_id": 43719, "author_profile": "https://wordpress.stackexchange.com/users/43719", "pm_score": 7, "selected": true, "text": "<p>WordPress uses the jQuery migrate script to ensure backwards compatibility for any plugins or themes you might be...
2016/04/24
[ "https://wordpress.stackexchange.com/questions/224661", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/58895/" ]
Why is there a constant notice, > > JQMIGRATE: Migrate is installed, version 1.4.0 > > > that points to `load-scripts.php` in my console when I updated my theme to WordPress 4.5, and how can it be removed? It's not an error, but it's always present in my console, and I really don't see what's the point of it. Sh...
WordPress uses the jQuery migrate script to ensure backwards compatibility for any plugins or themes you might be using which use functionality removed from newer versions of jQuery. With the release of WordPress 4.5, it appears they have upgraded the version of jQuery migrate from [v1.2.1](http://code.jquery.com/jque...
224,670
<p>I use this to display the featured image for each post. If the post does not have a featured image, a generic image will be displayed:</p> <pre><code>&lt;?php if ( has_post_thumbnail() ) { echo '&lt;a href="' . get_permalink($post-&gt;ID) . '" &gt;'; the_post_thumbnail(); echo '&lt;/a&gt;'; } else { ...
[ { "answer_id": 224672, "author": "Max Yudin", "author_id": 11761, "author_profile": "https://wordpress.stackexchange.com/users/11761", "pm_score": 1, "selected": false, "text": "<p>The problem is when you are trying to get the template directory. You are <code>getting</code> it instead o...
2016/04/24
[ "https://wordpress.stackexchange.com/questions/224670", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82313/" ]
I use this to display the featured image for each post. If the post does not have a featured image, a generic image will be displayed: ``` <?php if ( has_post_thumbnail() ) { echo '<a href="' . get_permalink($post->ID) . '" >'; the_post_thumbnail(); echo '</a>'; } else { echo '<img src="<?php bloginfo(...
I have updated your code so that the fallback image has post permalink. I hope this helps: ``` if ( has_post_thumbnail() ) { echo '<a href="' . get_permalink($post->ID) . '" >'; the_post_thumbnail(); echo '</a>'; } else { echo '<a href="' . get_permalink($post->ID) . '" ><img src="'. get_stylesheet_di...
224,735
<p>I have a WordPress Multisite that uses a special query that combines all the posts on the network and uses the main site to display all posts in the network. </p> <p>Anyway, I would like to have my site use infinite scroll. No matter what plugins I use, it won't use infinite scroll. </p> <p>Here's how the query wo...
[ { "answer_id": 224672, "author": "Max Yudin", "author_id": 11761, "author_profile": "https://wordpress.stackexchange.com/users/11761", "pm_score": 1, "selected": false, "text": "<p>The problem is when you are trying to get the template directory. You are <code>getting</code> it instead o...
2016/04/25
[ "https://wordpress.stackexchange.com/questions/224735", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8049/" ]
I have a WordPress Multisite that uses a special query that combines all the posts on the network and uses the main site to display all posts in the network. Anyway, I would like to have my site use infinite scroll. No matter what plugins I use, it won't use infinite scroll. Here's how the query works on my site: ...
I have updated your code so that the fallback image has post permalink. I hope this helps: ``` if ( has_post_thumbnail() ) { echo '<a href="' . get_permalink($post->ID) . '" >'; the_post_thumbnail(); echo '</a>'; } else { echo '<a href="' . get_permalink($post->ID) . '" ><img src="'. get_stylesheet_di...
224,748
<p>I've got a custom post type called productpopups, and to sort them I have a custom taxonomy called productcategory. The post type has it's own special template (single-productpopup.php) and I'm trying to show each products category with a link to the category. The problem I have is the following:</p> <p>The link fo...
[ { "answer_id": 224768, "author": "Victor", "author_id": 92972, "author_profile": "https://wordpress.stackexchange.com/users/92972", "pm_score": 0, "selected": false, "text": "<p>If you created the taxonomy yourself, you could set your own slug for the custom taxonomy. For Example:</p>\n\...
2016/04/25
[ "https://wordpress.stackexchange.com/questions/224748", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/56659/" ]
I've got a custom post type called productpopups, and to sort them I have a custom taxonomy called productcategory. The post type has it's own special template (single-productpopup.php) and I'm trying to show each products category with a link to the category. The problem I have is the following: The link for each pro...
The code that I finally came up with to fix the problem! ``` <?php global $wpdb; $catresult = array(); $postid = get_the_ID(); $query1c = "SELECT wp_posts.ID, wp_terms.`name` AS `Category`, wp_pods_productcategory.`pc-url` AS `Url` FROM wp_posts INNER JOIN wp_term_relationships ON wp_posts.ID = wp_term_relationships.o...
224,759
<p>I want to use post types to style video posts differently. This should be quite easily achieved with custom post types. </p> <p>But I only want the video post type to affect the post when it is in "single". </p> <p>In other words I want the front page to stay as it is but when a video post is clicked on (and singl...
[ { "answer_id": 224768, "author": "Victor", "author_id": 92972, "author_profile": "https://wordpress.stackexchange.com/users/92972", "pm_score": 0, "selected": false, "text": "<p>If you created the taxonomy yourself, you could set your own slug for the custom taxonomy. For Example:</p>\n\...
2016/04/25
[ "https://wordpress.stackexchange.com/questions/224759", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82313/" ]
I want to use post types to style video posts differently. This should be quite easily achieved with custom post types. But I only want the video post type to affect the post when it is in "single". In other words I want the front page to stay as it is but when a video post is clicked on (and single.php is rendered...
The code that I finally came up with to fix the problem! ``` <?php global $wpdb; $catresult = array(); $postid = get_the_ID(); $query1c = "SELECT wp_posts.ID, wp_terms.`name` AS `Category`, wp_pods_productcategory.`pc-url` AS `Url` FROM wp_posts INNER JOIN wp_term_relationships ON wp_posts.ID = wp_term_relationships.o...
224,783
<p>I was trying to add a content filter and i discovered that the filter was being called 3 times in total. I tried slowly deleting all of the plugins and eventually found that it was Yoast that was causing this. This is absolutely insane. This means that ever single content filter gets called 3 times every single time...
[ { "answer_id": 224786, "author": "Z. Zlatev", "author_id": 4192, "author_profile": "https://wordpress.stackexchange.com/users/4192", "pm_score": 1, "selected": false, "text": "<p>Not sure what your question exactly is but yeah - for every <code>apply_filters( 'the_content', '...' );</cod...
2016/04/25
[ "https://wordpress.stackexchange.com/questions/224783", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/190834/" ]
I was trying to add a content filter and i discovered that the filter was being called 3 times in total. I tried slowly deleting all of the plugins and eventually found that it was Yoast that was causing this. This is absolutely insane. This means that ever single content filter gets called 3 times every single time? T...
The core of your problem is that `the_content` is a filter not an action, and it is supposed to return values, not echo them. As for the "called number of times" part of the question, yes any hook can be called unlimited number of time. If you find that you need to return one result on the first call and different on ...
224,800
<p>I'm trying to push a shortcode parameter value to a template file but for some reason I can't get the array value that I'm targeting into a single variable. Here is my code and the shortcode I'm using:</p> <pre><code>function content_table($atts) { $atts = shortcode_atts(array( 'tablepageid' =&gt; '' ...
[ { "answer_id": 224840, "author": "Z. Zlatev", "author_id": 4192, "author_profile": "https://wordpress.stackexchange.com/users/4192", "pm_score": 2, "selected": true, "text": "<p>You are probably confused by the output of <code>array_values()</code> which will always get you only array va...
2016/04/25
[ "https://wordpress.stackexchange.com/questions/224800", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/64789/" ]
I'm trying to push a shortcode parameter value to a template file but for some reason I can't get the array value that I'm targeting into a single variable. Here is my code and the shortcode I'm using: ``` function content_table($atts) { $atts = shortcode_atts(array( 'tablepageid' => '' ), $atts); ...
You are probably confused by the output of `array_values()` which will always get you only array values without keys while `$atts` variable is actually an associative array. To extract your attribute use `$arr = $atts['tablepageid'];` Cheers
224,808
<p>What would be the right way of using variable with same data in two functions? Is next approach good practice? I have a few of these variables set up in functions.php</p> <pre><code> $a = array('asdf', 'asdf', 'asdfasd'); add_filter( 'query_vars', 'themeslug_query_vars' , 10, 1 ); function themeslug_qu...
[ { "answer_id": 224810, "author": "Caspar", "author_id": 27191, "author_profile": "https://wordpress.stackexchange.com/users/27191", "pm_score": 3, "selected": true, "text": "<p>As a matter of good coding practice, global variables are problematic at best, dangerous at worst. They should ...
2016/04/25
[ "https://wordpress.stackexchange.com/questions/224808", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/85304/" ]
What would be the right way of using variable with same data in two functions? Is next approach good practice? I have a few of these variables set up in functions.php ``` $a = array('asdf', 'asdf', 'asdfasd'); add_filter( 'query_vars', 'themeslug_query_vars' , 10, 1 ); function themeslug_query_vars( $qvar...
As a matter of good coding practice, global variables are problematic at best, dangerous at worst. They should be avoided if at all possible. Why? Because what if some other plugin developer also decides to define`$a` as a global? Whatever that plugin is doing will now overwrite your global `$a` and yours has the poten...
224,816
<p>So I've been tinkering with the admin roles and I can't seem to be able to revoke create page rights for the admin. I can only find 'Edit page'.</p> <p>If I remove Edit page, the entire pages tab goes away(probably because of not enough rights)..</p> <p>Is there a way to disable creating/deleting pages and keep th...
[ { "answer_id": 224810, "author": "Caspar", "author_id": 27191, "author_profile": "https://wordpress.stackexchange.com/users/27191", "pm_score": 3, "selected": true, "text": "<p>As a matter of good coding practice, global variables are problematic at best, dangerous at worst. They should ...
2016/04/25
[ "https://wordpress.stackexchange.com/questions/224816", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/91852/" ]
So I've been tinkering with the admin roles and I can't seem to be able to revoke create page rights for the admin. I can only find 'Edit page'. If I remove Edit page, the entire pages tab goes away(probably because of not enough rights).. Is there a way to disable creating/deleting pages and keep the pages tab? I h...
As a matter of good coding practice, global variables are problematic at best, dangerous at worst. They should be avoided if at all possible. Why? Because what if some other plugin developer also decides to define`$a` as a global? Whatever that plugin is doing will now overwrite your global `$a` and yours has the poten...
224,817
<p>I am trying to modify my loop to save post data by category. I found some code on this site that saved the post's titles based on their categories and tried to modify this to save the post's content. However, while <code>get_the_title</code> and <code>get_the_category</code> work, <code>get_the_content</code> return...
[ { "answer_id": 224860, "author": "Owais Alam", "author_id": 91939, "author_profile": "https://wordpress.stackexchange.com/users/91939", "pm_score": 2, "selected": false, "text": "<p><code>echo $post-&gt;post_content;</code> will echo your post content. Keep in mind though, it's raw out o...
2016/04/25
[ "https://wordpress.stackexchange.com/questions/224817", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92721/" ]
I am trying to modify my loop to save post data by category. I found some code on this site that saved the post's titles based on their categories and tried to modify this to save the post's content. However, while `get_the_title` and `get_the_category` work, `get_the_content` returns null. Here is the code: ``` if (...
`echo $post->post_content;` will echo your post content. Keep in mind though, it's raw out of the database (same as `get_the_content()`). If you want to apply the same filters that `the_content()` receives, follow the instructions in the [codex](https://developer.wordpress.org/reference/functions/the_content/#Alternati...
224,945
<p>I'm a little bit confused with the use of the Loop. This is my first theme and i just use index.php currently to display all my pages. It works fine for pages but have_posts return false when i try to display a single post. Here is the code of the index.php:</p> <pre><code>&lt;?php get_header(); ?&gt; &lt;div class...
[ { "answer_id": 224956, "author": "Nabeel Khan", "author_id": 57389, "author_profile": "https://wordpress.stackexchange.com/users/57389", "pm_score": -1, "selected": false, "text": "<p>You don't have any posts query running probably.</p>\n\n<p>Try this (added <code>query_posts();</code>)<...
2016/04/27
[ "https://wordpress.stackexchange.com/questions/224945", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/93085/" ]
I'm a little bit confused with the use of the Loop. This is my first theme and i just use index.php currently to display all my pages. It works fine for pages but have\_posts return false when i try to display a single post. Here is the code of the index.php: ``` <?php get_header(); ?> <div class="left"> <?php ...
Late answer but, one possible scenario this could be happening is if you register two custom post types with the same permalink slug. You can debug this by doing a `var_dump` of the global variable `$wp_query`. ```php global $wp_query; var_dump($wp_query); ``` Check to see if the `post_type` in the query matches th...
224,947
<p>How to browse other website without leaving domain?</p> <p>for ex. my website is websites1.com and i want to someone to goto website2.com but doamin name in address bar must be website1.com only.</p>
[ { "answer_id": 224956, "author": "Nabeel Khan", "author_id": 57389, "author_profile": "https://wordpress.stackexchange.com/users/57389", "pm_score": -1, "selected": false, "text": "<p>You don't have any posts query running probably.</p>\n\n<p>Try this (added <code>query_posts();</code>)<...
2016/04/27
[ "https://wordpress.stackexchange.com/questions/224947", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/93087/" ]
How to browse other website without leaving domain? for ex. my website is websites1.com and i want to someone to goto website2.com but doamin name in address bar must be website1.com only.
Late answer but, one possible scenario this could be happening is if you register two custom post types with the same permalink slug. You can debug this by doing a `var_dump` of the global variable `$wp_query`. ```php global $wp_query; var_dump($wp_query); ``` Check to see if the `post_type` in the query matches th...
224,964
<p>Why <code>do_shortcode</code> doesn't work in a REST call ?</p> <p>In the example below, <code>do_shortcode</code> exists, but the shortcode isn't interpreted.</p> <h2>Route declaration</h2> <pre><code>/* Adding a route with callback is interpret_shortcode function */ add_action( 'rest_api_init', function ...
[ { "answer_id": 224972, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 0, "selected": false, "text": "<p>Availability of shortcodes defined by plugins at any point of the code is undefined expect for (and even ...
2016/04/27
[ "https://wordpress.stackexchange.com/questions/224964", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92858/" ]
Why `do_shortcode` doesn't work in a REST call ? In the example below, `do_shortcode` exists, but the shortcode isn't interpreted. Route declaration ----------------- ``` /* Adding a route with callback is interpret_shortcode function */ add_action( 'rest_api_init', function () { register_rest_route( ...
Solution -------- I find a workaround for this issue. I post it for posterity. This is an issue, several issue, between divi and REST Api. In the exemple bellow, `register_rest_field` is used instead of `register_rest_route`, but the fix is valid for both method. This solution could not be very futureproof. But, a...
224,976
<p>I hope I can find some help or advice here regarding custom taxonomies auto-complete (maybe there is a ready-plugin but I am not aware of it).</p> <p>I have custom taxonomy which have around 500 items. So when I admin user create new post and need to choose one or multiple item in add/edit post screen, he needs to ...
[ { "answer_id": 224972, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 0, "selected": false, "text": "<p>Availability of shortcodes defined by plugins at any point of the code is undefined expect for (and even ...
2016/04/27
[ "https://wordpress.stackexchange.com/questions/224976", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31498/" ]
I hope I can find some help or advice here regarding custom taxonomies auto-complete (maybe there is a ready-plugin but I am not aware of it). I have custom taxonomy which have around 500 items. So when I admin user create new post and need to choose one or multiple item in add/edit post screen, he needs to scroll dow...
Solution -------- I find a workaround for this issue. I post it for posterity. This is an issue, several issue, between divi and REST Api. In the exemple bellow, `register_rest_field` is used instead of `register_rest_route`, but the fix is valid for both method. This solution could not be very futureproof. But, a...
224,984
<p>I'm trying to change the category for all posts of an author. I've been looking on here for about an hour and haven't found a solution.. </p> <p>Any help would be greatly appreciated :)</p> <p>Thanks, j03</p>
[ { "answer_id": 224972, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 0, "selected": false, "text": "<p>Availability of shortcodes defined by plugins at any point of the code is undefined expect for (and even ...
2016/04/27
[ "https://wordpress.stackexchange.com/questions/224984", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/93113/" ]
I'm trying to change the category for all posts of an author. I've been looking on here for about an hour and haven't found a solution.. Any help would be greatly appreciated :) Thanks, j03
Solution -------- I find a workaround for this issue. I post it for posterity. This is an issue, several issue, between divi and REST Api. In the exemple bellow, `register_rest_field` is used instead of `register_rest_route`, but the fix is valid for both method. This solution could not be very futureproof. But, a...
224,989
<p>I was trying to update my wordpress core to 4.5.1 but my system was missing some permissions, and now after giving correct permission, I cannot get rid of that message and I cannot upgrade. Tried to look for a .maintainance file but there is not.</p> <p>How do I update now?</p> <p>Thanks for help</p>
[ { "answer_id": 226009, "author": "Alexander Ushakov", "author_id": 93707, "author_profile": "https://wordpress.stackexchange.com/users/93707", "pm_score": 7, "selected": false, "text": "<p>It is an automatic lock to prevent simultaneous core updates. It will be gone after 15 minutes. If ...
2016/04/27
[ "https://wordpress.stackexchange.com/questions/224989", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/93040/" ]
I was trying to update my wordpress core to 4.5.1 but my system was missing some permissions, and now after giving correct permission, I cannot get rid of that message and I cannot upgrade. Tried to look for a .maintainance file but there is not. How do I update now? Thanks for help
It is an automatic lock to prevent simultaneous core updates. It will be gone after 15 minutes. If you don't want to wait, delete the record from options table – usually `wp_options`. Since Wordpress 4.5: ``` option_name = 'core_updater.lock' ``` If you have an **older** installation (before Wordpress 4.5): ``` op...
225,002
<p>I'm working on a theme for a travel blog and the author likes to insert small images in the text of their posts (<a href="http://tracysbackpack.com/2016/04/flying-2400-miles-to-see-hamilton/" rel="nofollow">an example is here</a>).</p> <p>I want the images to alternatingly float left or right (so the first image fl...
[ { "answer_id": 226009, "author": "Alexander Ushakov", "author_id": 93707, "author_profile": "https://wordpress.stackexchange.com/users/93707", "pm_score": 7, "selected": false, "text": "<p>It is an automatic lock to prevent simultaneous core updates. It will be gone after 15 minutes. If ...
2016/04/27
[ "https://wordpress.stackexchange.com/questions/225002", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92529/" ]
I'm working on a theme for a travel blog and the author likes to insert small images in the text of their posts ([an example is here](http://tracysbackpack.com/2016/04/flying-2400-miles-to-see-hamilton/)). I want the images to alternatingly float left or right (so the first image floats left then the next floats right...
It is an automatic lock to prevent simultaneous core updates. It will be gone after 15 minutes. If you don't want to wait, delete the record from options table – usually `wp_options`. Since Wordpress 4.5: ``` option_name = 'core_updater.lock' ``` If you have an **older** installation (before Wordpress 4.5): ``` op...
225,032
<p>Is it possible to add a piece of code snippets inside wordpress standard function ? In my case I am developing a plugin that will trace the exact location of the caller of wp_delete_attachment method in wordpress. I can acheive that by <strong>debug_backtrace()</strong> but this method must be called inside the meth...
[ { "answer_id": 225035, "author": "RRikesh", "author_id": 17305, "author_profile": "https://wordpress.stackexchange.com/users/17305", "pm_score": 1, "selected": false, "text": "<p>It depends what you want to do.</p>\n\n<p>If you look into the <a href=\"https://developer.wordpress.org/refe...
2016/04/28
[ "https://wordpress.stackexchange.com/questions/225032", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/93014/" ]
Is it possible to add a piece of code snippets inside wordpress standard function ? In my case I am developing a plugin that will trace the exact location of the caller of wp\_delete\_attachment method in wordpress. I can acheive that by **debug\_backtrace()** but this method must be called inside the method you wish t...
I solve the problem by hooking my function to `delete_attachment` hook, then putting the debug trace inside my function and filtering the `wp_delete_attachment`, by this I can retrieve what file and line number where the wp\_delete\_attachment is called. ``` add_action( 'delete_attachment', 'your_function' ); functio...
225,067
<p>I am receiving many requests to my wp-login.php and xmlrpc file, now I just set up an htaccess to prevent requests to xmlrpc, but how do you suggest me to block wp-login?</p> <p>thanks</p>
[ { "answer_id": 241512, "author": "Feriman", "author_id": 78021, "author_profile": "https://wordpress.stackexchange.com/users/78021", "pm_score": 0, "selected": false, "text": "<p>Try it to paste in your .htaccess file:</p>\n\n<pre><code>&lt;IfModule mod_rewrite.c&gt;\nRewriteEngine on\nR...
2016/04/28
[ "https://wordpress.stackexchange.com/questions/225067", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/93040/" ]
I am receiving many requests to my wp-login.php and xmlrpc file, now I just set up an htaccess to prevent requests to xmlrpc, but how do you suggest me to block wp-login? thanks
Additionally to using htaccess, you can disable the XML-RPC function by adding the following to your child theme's `functions.php`: ``` # Set XML-RPC features to false add_filter( 'xmlrpc_enabled', '__return_false' ); add_filter( 'pre_option_enable_xmlrpc', '__return_zero' ); ```
225,075
<p>Which WordPress function allows you to include the <code>footer.php</code> file into <code>index.php</code> file?</p>
[ { "answer_id": 225077, "author": "Michael Wilson", "author_id": 93168, "author_profile": "https://wordpress.stackexchange.com/users/93168", "pm_score": 3, "selected": true, "text": "<p>Add </p>\n\n<pre><code>&lt;?php get_footer(); ?&gt;\n</code></pre>\n\n<p>into index.php or the template...
2016/04/28
[ "https://wordpress.stackexchange.com/questions/225075", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/59477/" ]
Which WordPress function allows you to include the `footer.php` file into `index.php` file?
Add ``` <?php get_footer(); ?> ``` into index.php or the template you are using Then create footer.php and add in something like this: ``` <?php /* Always have wp_footer() just before the closing </body> * tag of your theme, or you will break many plugins, which * generally use this hook to reference ...
225,083
<p>I'm using wp cli to import the same featured image for around 2,000 posts. I did a couple tests to see if the image would be duplicated or if WordPress would notice that the image already exists in the media library and use it. Sadly it just duplicates the image. </p> <p>Command I'm using: <code>wp media import htt...
[ { "answer_id": 225116, "author": "Aric Watson", "author_id": 81449, "author_profile": "https://wordpress.stackexchange.com/users/81449", "pm_score": 0, "selected": false, "text": "<p>You should be able to write a php script to do this for each post. You'll need to do a query to get all t...
2016/04/28
[ "https://wordpress.stackexchange.com/questions/225083", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/93113/" ]
I'm using wp cli to import the same featured image for around 2,000 posts. I did a couple tests to see if the image would be duplicated or if WordPress would notice that the image already exists in the media library and use it. Sadly it just duplicates the image. Command I'm using: `wp media import http://example.com...
You can use `wp media import` to import the image once. Once you have the ID for the attachment created, you can run: ``` wp post list --post_type=post --format=ids | xargs -0 -d ' ' -I % wp post meta add % _thumbnail_id <thumbnail-id> ``` Make sure to replace `<thumbnail-id>` with the actual attachment ID.
225,085
<p>The code below gets the image but I want it to be a background image. I believe I need to save the image as a variable first and then echo it out somehow. My PHP is not great so please give an example using the code. No esoteric answers, thanks.</p> <pre><code>&lt;div class="main-slider" class="flexslider"&gt; ...
[ { "answer_id": 225087, "author": "mread1208", "author_id": 70293, "author_profile": "https://wordpress.stackexchange.com/users/70293", "pm_score": 3, "selected": true, "text": "<p>You are correct, you will need to get the image URL and set is as a variable so you can echo it out as an in...
2016/04/28
[ "https://wordpress.stackexchange.com/questions/225085", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/80362/" ]
The code below gets the image but I want it to be a background image. I believe I need to save the image as a variable first and then echo it out somehow. My PHP is not great so please give an example using the code. No esoteric answers, thanks. ``` <div class="main-slider" class="flexslider"> <ul class="slides"> ...
You are correct, you will need to get the image URL and set is as a variable so you can echo it out as an inline style in your HTML. I've updated your foreach loop below and set the image as an inline style of your `<li>` element: ``` foreach( $postQuery as $post ) : setup_postdata($post); if ( has_post_thumbnail(...
225,089
<p>I just trasformed an old website to a one-page Wordpress.</p> <p>The old website had several URLS, now there's ony 1: the homepage. Plus another page with privacy policy.</p> <p>Hence I would like to redirect all URLS except the one with slug "privacy" to the homepage.</p> <p>This is what I'm trying, without succ...
[ { "answer_id": 225101, "author": "Florian", "author_id": 52583, "author_profile": "https://wordpress.stackexchange.com/users/52583", "pm_score": 0, "selected": false, "text": "<p>Please try </p>\n\n<pre><code>&lt;IfModule mod_rewrite.c&gt;\nRewriteRule ^/privacy-policy/? privacy-policy [...
2016/04/28
[ "https://wordpress.stackexchange.com/questions/225089", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4155/" ]
I just trasformed an old website to a one-page Wordpress. The old website had several URLS, now there's ony 1: the homepage. Plus another page with privacy policy. Hence I would like to redirect all URLS except the one with slug "privacy" to the homepage. This is what I'm trying, without success: ``` #custom redire...
Problems -------- > > I get too many redirect: all urls redirect infinitely to themselves, why? > > > Apache rewrite rules are processed top-to-bottom, so your custom rewrite rule is always processed first. The `R` redirect flag instructs Apache to tell the browser to make a new request to the altered URL instead...
225,093
<p>In spite of many similar posts, all the proposed solutions didn't work for me, so here we are. </p> <p>I have the following script :</p> <pre><code>jQuery('#term').keyup(ajaxChange); function ajaxChange(){ var newFormChange = jQuery("#term").val(); alert (newFormChange); ...
[ { "answer_id": 225095, "author": "tam", "author_id": 18668, "author_profile": "https://wordpress.stackexchange.com/users/18668", "pm_score": 0, "selected": false, "text": "<p>It seems there is a problem with at <code>url: \"/wp-admin/admin-ajax.php\"</code>, instead try adding the full p...
2016/04/28
[ "https://wordpress.stackexchange.com/questions/225093", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92582/" ]
In spite of many similar posts, all the proposed solutions didn't work for me, so here we are. I have the following script : ``` jQuery('#term').keyup(ajaxChange); function ajaxChange(){ var newFormChange = jQuery("#term").val(); alert (newFormChange); jQuery.ajax({ ...
Note that the `action` should be inside the `data` key. In your post request there is no key named as `action` therefore, the callback function is never being called. Consider this example:- ``` jQuery.ajax({ type:"POST", url: "/wp-admin/admin-ajax.php", data: { action: "my_test_action", ...
225,102
<p>I've tried to look for a specific answer/tutorial on this subject but I'm coming up short and wanted to see what the SE community could suggest. At this point, any guidance whatsoever would be most appreciated. </p> <p>Basically I'm trying to determine the current page being viewed within a class method I'm setting...
[ { "answer_id": 225109, "author": "sălă", "author_id": 93062, "author_profile": "https://wordpress.stackexchange.com/users/93062", "pm_score": 0, "selected": false, "text": "<p>Have you tried <a href=\"https://developer.wordpress.org/reference/functions/get_the_id/\" rel=\"nofollow\"><cod...
2016/04/28
[ "https://wordpress.stackexchange.com/questions/225102", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/86773/" ]
I've tried to look for a specific answer/tutorial on this subject but I'm coming up short and wanted to see what the SE community could suggest. At this point, any guidance whatsoever would be most appreciated. Basically I'm trying to determine the current page being viewed within a class method I'm setting up, but I...
<https://wordpress.stackexchange.com/a/199997/86773> As the advice suggested here, switching my hook to "wp" instead of "init" allowed me to make the page comparison I wanted using is\_page().
225,120
<p>I wish to hide certain posts for anyone that is not logged in. I tried the Restrict Content (RC) plugin but that did only hide the content of posts, i wish to omit the post completely.</p> <p>Using RC as a foundation i tried the following:</p> <pre><code>function hideFromUnknownUsers($postObject) { $rcUserLeve...
[ { "answer_id": 225109, "author": "sălă", "author_id": 93062, "author_profile": "https://wordpress.stackexchange.com/users/93062", "pm_score": 0, "selected": false, "text": "<p>Have you tried <a href=\"https://developer.wordpress.org/reference/functions/get_the_id/\" rel=\"nofollow\"><cod...
2016/04/28
[ "https://wordpress.stackexchange.com/questions/225120", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/93182/" ]
I wish to hide certain posts for anyone that is not logged in. I tried the Restrict Content (RC) plugin but that did only hide the content of posts, i wish to omit the post completely. Using RC as a foundation i tried the following: ``` function hideFromUnknownUsers($postObject) { $rcUserLevel = get_post_meta ( $...
<https://wordpress.stackexchange.com/a/199997/86773> As the advice suggested here, switching my hook to "wp" instead of "init" allowed me to make the page comparison I wanted using is\_page().
225,124
<p>I've built a site for a client, only ten pages, nothing especially big, and created a role for the group members called Blogger, as the staff need to all be able to both blog and access a couple of plugins (for a client carousel and to add testimonials). I disabled their ability to edit pages using a plugin called A...
[ { "answer_id": 225126, "author": "mukto90", "author_id": 57944, "author_profile": "https://wordpress.stackexchange.com/users/57944", "pm_score": 0, "selected": false, "text": "<p>Adminimize does not <strong>remove</strong> menu items etc, it just keeps them <strong>visually hidden</stron...
2016/04/28
[ "https://wordpress.stackexchange.com/questions/225124", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/93190/" ]
I've built a site for a client, only ten pages, nothing especially big, and created a role for the group members called Blogger, as the staff need to all be able to both blog and access a couple of plugins (for a client carousel and to add testimonials). I disabled their ability to edit pages using a plugin called Admi...
Adminimize does not **remove** menu items etc, it just keeps them **visually hidden**. In other words, your admin pages is still accessible. Add this code to your `functions.php` file: ``` add_action('admin_menu', 'edit_trustees_page'); function edit_trustees_page() { global $submenu; $trustees_page_id = 1; /...
225,152
<h2>Question</h2> <p>Is there a way to remove a specific shortcode, say <code>[print_me]</code> from all the posts where it appears in one shot. And I don't mean mask it or filter it so it doesn't show up while it stays in the <code>post_content</code>. I want it GONE GONE.</p> <h2>Attempts So Far ...</h2> <p>So far...
[ { "answer_id": 225156, "author": "Frits", "author_id": 93169, "author_profile": "https://wordpress.stackexchange.com/users/93169", "pm_score": 3, "selected": false, "text": "<p>There is an easier way to do this:</p>\n\n<pre><code>add_filter( 'the_content', 'my_post_content_remove_shortco...
2016/04/29
[ "https://wordpress.stackexchange.com/questions/225152", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/37180/" ]
Question -------- Is there a way to remove a specific shortcode, say `[print_me]` from all the posts where it appears in one shot. And I don't mean mask it or filter it so it doesn't show up while it stays in the `post_content`. I want it GONE GONE. Attempts So Far ... ------------------- So far what I have done is ...
For the permanent solution, your SQL query is slightly off - you need: ``` UPDATE db1357924680.wp_posts SET post_content = REPLACE( post_content, '[print_me]', '' ) WHERE post_content LIKE '%[print_me]%' ``` [MySQL replace example](https://techjourney.net/how-to-find-and-replace-text-in-mysql-database-using-sql/)
225,171
<p>I am inserting data in the custom table using the <code>$wpdb-&gt;insert</code>. However, upon error I don't seem to get any information from <code>$wpdb-&gt;last_error</code>. What could be the cause of this?</p> <p>I already have this configuration set in <code>wp-config</code></p> <pre><code>define('WP_DEBUG', ...
[ { "answer_id": 225174, "author": "TheDeadMedic", "author_id": 1685, "author_profile": "https://wordpress.stackexchange.com/users/1685", "pm_score": 3, "selected": false, "text": "<p>If you want the <em>query</em>, that'll be <code>$wpdb-&gt;last_query</code> (note that you also do not ne...
2016/04/29
[ "https://wordpress.stackexchange.com/questions/225171", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22857/" ]
I am inserting data in the custom table using the `$wpdb->insert`. However, upon error I don't seem to get any information from `$wpdb->last_error`. What could be the cause of this? I already have this configuration set in `wp-config` ``` define('WP_DEBUG', false); define('SAVEQUERIES', true); ``` The code is as be...
If you want the *query*, that'll be `$wpdb->last_query` (note that you also do not need `SAVEQUERIES`, that's only if you want a log of *every* query (`$wpdb->queries`) `last_error` is... well, the error! **Update:** Possible explanation for `last_error` being empty - this is the source of `wpdb::query()`: ``` // If...
225,182
<p>Sorry, I know this kind of question has been asked before but I can't quite figure it out. </p> <p>I'm trying to hide the city image on this page:</p> <p><a href="http://learnenglish20.com/buy-tokens/" rel="nofollow">http://learnenglish20.com/buy-tokens/</a></p> <p>I put this CSS in my child theme: </p> <pre><c...
[ { "answer_id": 225183, "author": "tam", "author_id": 18668, "author_profile": "https://wordpress.stackexchange.com/users/18668", "pm_score": 1, "selected": false, "text": "<p>Just override the background property with the below code in your child css.</p>\n\n<pre><code>#title {\n back...
2016/04/29
[ "https://wordpress.stackexchange.com/questions/225182", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/93230/" ]
Sorry, I know this kind of question has been asked before but I can't quite figure it out. I'm trying to hide the city image on this page: <http://learnenglish20.com/buy-tokens/> I put this CSS in my child theme: ``` body.page-id-2557 #title-content { display: none !important; ``` } I think maybe I've got ...
Just override the background property with the below code in your child css. ``` #title { background: none !important; } ```
225,203
<p>Could use some help... using this code to call up a custom number of posts from a certain categorey and only want to display the first 15 characters. However, it is showing the same excerpt on each post versus showing the unique excerpt for each post. Can anyone help me out on this one? </p> <p>Code below is result...
[ { "answer_id": 225183, "author": "tam", "author_id": 18668, "author_profile": "https://wordpress.stackexchange.com/users/18668", "pm_score": 1, "selected": false, "text": "<p>Just override the background property with the below code in your child css.</p>\n\n<pre><code>#title {\n back...
2016/04/29
[ "https://wordpress.stackexchange.com/questions/225203", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/85626/" ]
Could use some help... using this code to call up a custom number of posts from a certain categorey and only want to display the first 15 characters. However, it is showing the same excerpt on each post versus showing the unique excerpt for each post. Can anyone help me out on this one? Code below is resulting in the...
Just override the background property with the below code in your child css. ``` #title { background: none !important; } ```
225,208
<p>I have a custom user database that is integrated with a wordpress website using a custom built plugin. I also want to integrate this user system into the comment system.</p> <p>I have found and completed the code that will handle comment submissions and reject bad ones, but i cannot find out how to actually overrid...
[ { "answer_id": 225210, "author": "tam", "author_id": 18668, "author_profile": "https://wordpress.stackexchange.com/users/18668", "pm_score": 0, "selected": false, "text": "<p>I believe you can hook your new function to <code>comment_template()</code> like this:</p>\n\n<pre><code>add_acti...
2016/04/29
[ "https://wordpress.stackexchange.com/questions/225208", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/190834/" ]
I have a custom user database that is integrated with a wordpress website using a custom built plugin. I also want to integrate this user system into the comment system. I have found and completed the code that will handle comment submissions and reject bad ones, but i cannot find out how to actually override the visu...
Now what if you have to add/remove fields from default contact form to change the feel of your comment box? I am eliminating website field from default comment box by playing with ‘fields’ argument:in comments.php ``` <?php $comment_args = array('title_reply' => 'Got Something To Say:', 'fields' => apply_filters('...
225,209
<p>I'm studying the theme "one page" and there is the following code:</p> <pre><code>function onepage_sections() { $sections = array(); $sections['service_section'] = array( 'id' =&gt; 'service_section', 'label' =&gt; __('Service Section', 'one-page'), 'callback' =&gt; 'onepage_service_section', ); $sect...
[ { "answer_id": 225210, "author": "tam", "author_id": 18668, "author_profile": "https://wordpress.stackexchange.com/users/18668", "pm_score": 0, "selected": false, "text": "<p>I believe you can hook your new function to <code>comment_template()</code> like this:</p>\n\n<pre><code>add_acti...
2016/04/29
[ "https://wordpress.stackexchange.com/questions/225209", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92028/" ]
I'm studying the theme "one page" and there is the following code: ``` function onepage_sections() { $sections = array(); $sections['service_section'] = array( 'id' => 'service_section', 'label' => __('Service Section', 'one-page'), 'callback' => 'onepage_service_section', ); $sections['blog_section'] = ...
Now what if you have to add/remove fields from default contact form to change the feel of your comment box? I am eliminating website field from default comment box by playing with ‘fields’ argument:in comments.php ``` <?php $comment_args = array('title_reply' => 'Got Something To Say:', 'fields' => apply_filters('...
225,280
<p>I need to create a simple plugin to show a list of categories inside the body of the post and, as I am new to coding, I searched for the basics and started to make little changes; it looks like this, by now:</p> <pre><code>// [cats] function catting ( $atts, $content = null ) { global $post; $categories = get_the_c...
[ { "answer_id": 225285, "author": "Usce", "author_id": 81451, "author_profile": "https://wordpress.stackexchange.com/users/81451", "pm_score": -1, "selected": false, "text": "<p>There is build in wordpress function for that , so you can use wp_list_categories() for that. Please refer <a h...
2016/04/30
[ "https://wordpress.stackexchange.com/questions/225280", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/93289/" ]
I need to create a simple plugin to show a list of categories inside the body of the post and, as I am new to coding, I searched for the basics and started to make little changes; it looks like this, by now: ``` // [cats] function catting ( $atts, $content = null ) { global $post; $categories = get_the_category_list( ...
I've modified your code to reflect the `wp_list_categories()` function reference as suggested by @Usce. This snippet will create an unordered list, remove the "Categories" list title, and add the `li` class with individual category ID so you can target each link in the list. `function catting ($atts, $content = null...
225,281
<p>After migrating my wordpress site users <strong>who are not Admins</strong> are redirected to the site's <strong>homepage after login</strong>. On the old site they were redirected on wp-admin. The Administrator is redirected to wp_admin as it should.</p> <p>I want the users to be redirected to <code>wp-admin</code...
[ { "answer_id": 225331, "author": "Hello Lili", "author_id": 91684, "author_profile": "https://wordpress.stackexchange.com/users/91684", "pm_score": 4, "selected": true, "text": "<p>Yeeey, I figured it out! Actually my theme had a redirect like this one in <code>functions.php</code>:</p>\...
2016/04/30
[ "https://wordpress.stackexchange.com/questions/225281", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/91684/" ]
After migrating my wordpress site users **who are not Admins** are redirected to the site's **homepage after login**. On the old site they were redirected on wp-admin. The Administrator is redirected to wp\_admin as it should. I want the users to be redirected to `wp-admin` after login. I changed siteurl from the dat...
Yeeey, I figured it out! Actually my theme had a redirect like this one in `functions.php`: ``` // Block Access to /wp-admin for non admins. function custom_blockusers_init() { if ( is_user_logged_in() && is_admin() && !current_user_can( 'administrator' ) ) { wp_redirect( home_url() ); exit; } } add_action...