M
M
malayamarisha2020-07-01 06:55:07
WordPress
malayamarisha, 2020-07-01 06:55:07

How to display a custom field in a widget?

Good day!
An arbitrary field "section_icon" (type "Image", Return format = Link to image) has been added to the headings. This field must be displayed in the widget.
The widget is finalized in the wp-includes/class-walker-category.php file.
I do this, but the link to the image is not displayed:

$meta_values = get_post_meta($category->term_id, 'section_icon', true);

Can you please tell me how it is possible to display an arbitrary field in the widget?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
malayamarisha, 2020-07-01
@malayamarisha

Outcome:

$term = get_queried_object();
$section_icon = get_field('section_icon', $term);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question