WP get_terms() returns error on admin side
This one might be a simple question, but it's driving me nuts :)
I'm trying to make an admin settings page on the wp-admin
side for which I need to get all the values of a certain category.
This is part of my test code:
$terms = get_terms( array(
'taxonomy' => 'my-category',
'hide_empty' => false,
) );
echo '<pre>';
var_dump($terms);
echo '</pre>';
But this returns an error. Something like "invalid taxonomy"
.
When I leave the 'taxonomy'
arg from get_terms()
it returns all the terms successfully. ( but of course I need to filter it by my tax term.
Anyone knows what's up? :)
Any help would be highly appreciated.
wordpress wp-admin
add a comment |
This one might be a simple question, but it's driving me nuts :)
I'm trying to make an admin settings page on the wp-admin
side for which I need to get all the values of a certain category.
This is part of my test code:
$terms = get_terms( array(
'taxonomy' => 'my-category',
'hide_empty' => false,
) );
echo '<pre>';
var_dump($terms);
echo '</pre>';
But this returns an error. Something like "invalid taxonomy"
.
When I leave the 'taxonomy'
arg from get_terms()
it returns all the terms successfully. ( but of course I need to filter it by my tax term.
Anyone knows what's up? :)
Any help would be highly appreciated.
wordpress wp-admin
add a comment |
This one might be a simple question, but it's driving me nuts :)
I'm trying to make an admin settings page on the wp-admin
side for which I need to get all the values of a certain category.
This is part of my test code:
$terms = get_terms( array(
'taxonomy' => 'my-category',
'hide_empty' => false,
) );
echo '<pre>';
var_dump($terms);
echo '</pre>';
But this returns an error. Something like "invalid taxonomy"
.
When I leave the 'taxonomy'
arg from get_terms()
it returns all the terms successfully. ( but of course I need to filter it by my tax term.
Anyone knows what's up? :)
Any help would be highly appreciated.
wordpress wp-admin
This one might be a simple question, but it's driving me nuts :)
I'm trying to make an admin settings page on the wp-admin
side for which I need to get all the values of a certain category.
This is part of my test code:
$terms = get_terms( array(
'taxonomy' => 'my-category',
'hide_empty' => false,
) );
echo '<pre>';
var_dump($terms);
echo '</pre>';
But this returns an error. Something like "invalid taxonomy"
.
When I leave the 'taxonomy'
arg from get_terms()
it returns all the terms successfully. ( but of course I need to filter it by my tax term.
Anyone knows what's up? :)
Any help would be highly appreciated.
wordpress wp-admin
wordpress wp-admin
edited Nov 14 '18 at 18:02
Gufran Hasan
3,57241426
3,57241426
asked Nov 14 '18 at 17:01
TimTim
88111
88111
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Please try this code
get_terms( array('taxonomy' => 'any_taxonomy','hide_empty' => false) );
https://developer.wordpress.org/reference/functions/get_terms/
Hey, thanks for your reply. That's the same code I have :) Or am I mistaken.
– Tim
Nov 14 '18 at 20:12
Okay, Please see this solution stackoverflow.com/questions/36898313/…
– Gufran Hasan
Nov 15 '18 at 5:25
That's also not the case I'm afraid. This goes for WP pre-4.5. And I'm currently running 4.9.8.
– Tim
Nov 15 '18 at 7:20
1
Hey Please see this post wordpress.stackexchange.com/questions/13480/…
– Gufran Hasan
Nov 15 '18 at 7:25
Yes! That's it. The first answer gave me the "why" and the second the solution. Thanks @gufran
– Tim
Nov 15 '18 at 13:15
|
show 2 more comments
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53305311%2fwp-get-terms-returns-error-on-admin-side%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Please try this code
get_terms( array('taxonomy' => 'any_taxonomy','hide_empty' => false) );
https://developer.wordpress.org/reference/functions/get_terms/
Hey, thanks for your reply. That's the same code I have :) Or am I mistaken.
– Tim
Nov 14 '18 at 20:12
Okay, Please see this solution stackoverflow.com/questions/36898313/…
– Gufran Hasan
Nov 15 '18 at 5:25
That's also not the case I'm afraid. This goes for WP pre-4.5. And I'm currently running 4.9.8.
– Tim
Nov 15 '18 at 7:20
1
Hey Please see this post wordpress.stackexchange.com/questions/13480/…
– Gufran Hasan
Nov 15 '18 at 7:25
Yes! That's it. The first answer gave me the "why" and the second the solution. Thanks @gufran
– Tim
Nov 15 '18 at 13:15
|
show 2 more comments
Please try this code
get_terms( array('taxonomy' => 'any_taxonomy','hide_empty' => false) );
https://developer.wordpress.org/reference/functions/get_terms/
Hey, thanks for your reply. That's the same code I have :) Or am I mistaken.
– Tim
Nov 14 '18 at 20:12
Okay, Please see this solution stackoverflow.com/questions/36898313/…
– Gufran Hasan
Nov 15 '18 at 5:25
That's also not the case I'm afraid. This goes for WP pre-4.5. And I'm currently running 4.9.8.
– Tim
Nov 15 '18 at 7:20
1
Hey Please see this post wordpress.stackexchange.com/questions/13480/…
– Gufran Hasan
Nov 15 '18 at 7:25
Yes! That's it. The first answer gave me the "why" and the second the solution. Thanks @gufran
– Tim
Nov 15 '18 at 13:15
|
show 2 more comments
Please try this code
get_terms( array('taxonomy' => 'any_taxonomy','hide_empty' => false) );
https://developer.wordpress.org/reference/functions/get_terms/
Please try this code
get_terms( array('taxonomy' => 'any_taxonomy','hide_empty' => false) );
https://developer.wordpress.org/reference/functions/get_terms/
answered Nov 14 '18 at 18:05
Gufran HasanGufran Hasan
3,57241426
3,57241426
Hey, thanks for your reply. That's the same code I have :) Or am I mistaken.
– Tim
Nov 14 '18 at 20:12
Okay, Please see this solution stackoverflow.com/questions/36898313/…
– Gufran Hasan
Nov 15 '18 at 5:25
That's also not the case I'm afraid. This goes for WP pre-4.5. And I'm currently running 4.9.8.
– Tim
Nov 15 '18 at 7:20
1
Hey Please see this post wordpress.stackexchange.com/questions/13480/…
– Gufran Hasan
Nov 15 '18 at 7:25
Yes! That's it. The first answer gave me the "why" and the second the solution. Thanks @gufran
– Tim
Nov 15 '18 at 13:15
|
show 2 more comments
Hey, thanks for your reply. That's the same code I have :) Or am I mistaken.
– Tim
Nov 14 '18 at 20:12
Okay, Please see this solution stackoverflow.com/questions/36898313/…
– Gufran Hasan
Nov 15 '18 at 5:25
That's also not the case I'm afraid. This goes for WP pre-4.5. And I'm currently running 4.9.8.
– Tim
Nov 15 '18 at 7:20
1
Hey Please see this post wordpress.stackexchange.com/questions/13480/…
– Gufran Hasan
Nov 15 '18 at 7:25
Yes! That's it. The first answer gave me the "why" and the second the solution. Thanks @gufran
– Tim
Nov 15 '18 at 13:15
Hey, thanks for your reply. That's the same code I have :) Or am I mistaken.
– Tim
Nov 14 '18 at 20:12
Hey, thanks for your reply. That's the same code I have :) Or am I mistaken.
– Tim
Nov 14 '18 at 20:12
Okay, Please see this solution stackoverflow.com/questions/36898313/…
– Gufran Hasan
Nov 15 '18 at 5:25
Okay, Please see this solution stackoverflow.com/questions/36898313/…
– Gufran Hasan
Nov 15 '18 at 5:25
That's also not the case I'm afraid. This goes for WP pre-4.5. And I'm currently running 4.9.8.
– Tim
Nov 15 '18 at 7:20
That's also not the case I'm afraid. This goes for WP pre-4.5. And I'm currently running 4.9.8.
– Tim
Nov 15 '18 at 7:20
1
1
Hey Please see this post wordpress.stackexchange.com/questions/13480/…
– Gufran Hasan
Nov 15 '18 at 7:25
Hey Please see this post wordpress.stackexchange.com/questions/13480/…
– Gufran Hasan
Nov 15 '18 at 7:25
Yes! That's it. The first answer gave me the "why" and the second the solution. Thanks @gufran
– Tim
Nov 15 '18 at 13:15
Yes! That's it. The first answer gave me the "why" and the second the solution. Thanks @gufran
– Tim
Nov 15 '18 at 13:15
|
show 2 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53305311%2fwp-get-terms-returns-error-on-admin-side%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown